TypeScript parser fails when file has first empty line: Start pointer should be before end pointer

Must-share information (formatted with Markdown):

  • We use SonarQube Server Developer Edition - v2025.1.2 (108896) - latest at the moment of writing
  • how is SonarQube deployed: Docker
  • what are you trying to achieve: we analyze TypeScript files and as soon as *.ts file has the very first line empty - SonarQube fails
  • what have you tried so far to achieve this: we removed empty first lines and it “fixed” the issue

Error:

Caused by: java.lang.IllegalArgumentException: Start pointer [line=1, lineOffset=0] should be before end pointer [line=1, lineOffset=0]

Example of the file that breaks SonarQube: basically any file with empty the very first line:


import { randomUUID } from 'node:crypto';
// other code

Please note the empty first line. When we remove it like this

-
import { randomUUID } from 'node:crypto';

SonarQube starts working again.

Just in case, the full stack trace:

java.lang.IllegalStateException: Analysis of JS/TS files failed
	at org.sonar.plugins.javascript.analysis.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:128)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:201)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:197)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:170)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:350)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:142)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:151)
	at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:66)
	at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:52)
Caused by: java.lang.IllegalArgumentException: Start pointer [line=1, lineOffset=0] should be before end pointer [line=1, lineOffset=0]
	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:383)
	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:324)
	at org.sonar.plugins.javascript.external.ExternalIssueRepository.save(ExternalIssueRepository.java:53)
	at org.sonar.plugins.javascript.analysis.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:101)
	... 22 common frames omitted
[ERROR] Bootstrapper: An error occurred: Error: Scanner engine failed with code 1

Hi @maks-rafalko,

I tried reproducing this on a project with a single file as you suggested. For me, I don’t have any issue and receive an issue to “Remove unused import”. I’ve tested with v2025.1 and v2025.3 on a Mac machine. Perhaps you have some non-standard (perhaps non-linux) characters for empty lines?

If you have a minimal reproduction project, maybe you are including some items like a package.json or a tsconfig.json that are causing the error. If you were able to share the full project (upload a zipped file) I could reproduce with, then I should be able to fix it.

I’m looking forward to your response.

Kind regards,
Michal