Eslint-bridge: IllegalArgumentException: Start pointer should be before end pointer

SonarQube Developer Edition Version 9.1 (build 47736)
Jenkins SonarQube Scanner plugin 2.13.1.
SonarQube scanner 4.6.2.2472

Analysis of javascript files fails repeatedly on the same file with error
on file:

 16:56:31.804 DEBUG: 'routes/integration.js' generated metadata with charset 'UTF-8'

error:

 16:56:31.966 DEBUG: Saving issue for rule prefer-regex-literals on line 184
 16:56:31.966 DEBUG: Saving issue for rule prefer-regex-literals on line 197
 16:56:31.966 DEBUG: Saving issue for rule regex-complexity on line 197
 16:56:31.970 ERROR: Failure during analysis, Node.js command to start eslint-bridge was: node /home/jenkins/src/apim/.scannerwork/.sonartmp/eslint-bridge-bundle/package/bin/server 33075 127.0.0.1 /home/jenkins/src/apim/.scannerwork true false /home/jenkins/src/apim/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules18375370661809243826/package
 java.lang.IllegalArgumentException: Start pointer [line=197, lineOffset=137] should be before end pointer [line=197, lineOffset=137]
 	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:348)
 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:289)
 	at org.sonar.plugins.javascript.eslint.EslintBasedIssue.newSecondaryLocation(EslintBasedIssue.java:77)
 	at org.sonar.plugins.javascript.eslint.EslintBasedIssue.lambda$saveIssue$0(EslintBasedIssue.java:55)
 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
 	at org.sonar.plugins.javascript.eslint.EslintBasedIssue.saveIssue(EslintBasedIssue.java:54)

and then skipped the remaining javascript files

 16:56:31.970 INFO: Sensor JavaScript analysis [javascript] (done) | time=63209ms
 16:56:31.970 INFO: Sensor TypeScript analysis [javascript]
 16:56:31.971 INFO: No input files found for analysis
 16:56:31.971 INFO: Sensor TypeScript analysis [javascript] (done) | time=1ms
 16:56:31.971 INFO: Sensor JavaScript/TypeScript Coverage [javascript]
 16:56:31.971 DEBUG: Using 'coverage/lcov.info' to resolve LCOV files

This is line 197:

        if (!(new RegExp('^(https?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.?)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(\:\d+)?(\/[-a-z\d%_.~+]*)*')).test(tlsClientProfileURL)) {

Workaround: exclude the file where analysis fails.

1 Like

hello @David_Deasy,

thanks for reporting this problem. I believe it was fixed in SonarQube 9.2 - released recently. Can you please try to upgrade and check again?

For reference, it should be fixed by this ticket Fix getRegexpRange to return correct range of the node when failed to… by saberduck · Pull Request #2857 · SonarSource/SonarJS · GitHub

Thanks. I will update when we have upgraded and tested.

Dave.

No joy, same issue after upgrading SonarQube server.

SonarQube

  • Developer Edition
  • Version 9.2.1 (build 49989)
    Jenkins SonarQube Scanner plugin 2.13.1.
    SonarQube scanner 4.6.2.2472
 11:37:53.529 INFO: SonarScanner 4.6.2.2472
 11:37:53.529 INFO: Java 11.0.11 Ubuntu (64-bit)
 11:37:53.530 INFO: Linux 5.4.0-81-generic amd64
11:40:26.997 DEBUG: 'routes/integration.js' generated metadata with charset 'UTF-8'
...
 11:40:27.276 DEBUG: Saving issue for rule prefer-regex-literals on line 184
 11:40:27.276 DEBUG: Saving issue for rule prefer-regex-literals on line 197
 11:40:27.276 DEBUG: Saving issue for rule regex-complexity on line 197
 11:40:27.283 ERROR: Failure during analysis, Node.js command to start eslint-bridge was: node /home/jenkins/src/apim/.scannerwork/.sonartmp/eslint-bridge-bundle/package/bin/server 42947 127.0.0.1 /home/jenkins/src/apim/.scannerwork true false /home/jenkins/src/apim/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules18154038411224968966/package
 java.lang.IllegalArgumentException: Start pointer [line=197, lineOffset=137] should be before end pointer [line=197, lineOffset=137]
 	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:348)
 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:289)
 	at org.sonar.plugins.javascript.eslint.EslintBasedIssue.newSecondaryLocation(EslintBasedIssue.java:77)
 	at org.sonar.plugins.javascript.eslint.EslintBasedIssue.lambda$saveIssue$0(EslintBasedIssue.java:55)
 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
 	at org.sonar.plugins.javascript.eslint.EslintBasedIssue.saveIssue(EslintBasedIssue.java:54)
 	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.saveIssues(AbstractEslintSensor.java:223)
 	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.processResponse(AbstractEslintSensor.java:213)
 	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.analyze(JavaScriptEslintBasedSensor.java:113)
 	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.runEslintAnalysis(JavaScriptEslintBasedSensor.java:92)
 	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.analyzeFiles(JavaScriptEslintBasedSensor.java:67)

Hi, is there any update on this?
The problem still happened when I tried Version 9.2.1.
Is it an open problem or considered fixed?

Thanks, /D.