Failure during analysis java.lang.IllegalArgumentException: 3 is not a valid line offset for pointer

Sonarqube * v10.5.1 (90531) * Community Edition
Windows Server
Sonarscanner CLI :sonar-scanner-5.0.1.3006-windows

Hello everyone
I’m analyzing a js project and sonarscanner fails on multiple .js files with this error:

ERROR: Failure during analysis
java.lang.IllegalArgumentException: 19 is not a valid line offset for pointer. File geco_job/globals.js has 1 character(s) at line 1140
at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:374)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:307)

this file at the line 1140 have a TAB a LF e a CR and is like the image attached
image

Can you help me to solve this problem?
Thanks

Hey there

What’s happening in the analysis before this? It would be great if you could provide more complete logs.

Hello, i had many similar IllegalArgumentExceptions when SonarScanner imports ESLint report.

build.log (718.7 KB)
Hi Colin,
this is the log
thank you for your help
Bruna

i don’t see the text is not a valid line offset for pointer. in that log file! Are you sure it’s the right one?

Yes, this is the result with the command attached :
sonarCommand.txt (12.8 KB)

Thanks.

Any chance you can provide a copy of geco_management/forms/dialog_import_file.js, either publicly or privately?

Hi Colin
how can i provide it in a private mode?

I’ve sent you a private message.

1 Like

Hi Colin, do you have some news about this problem ?

Hey there.

Somehow I missed the step of actually flagging this for expert eyes (and not just saying I would) :man_facepalming:

Sorry about that. It’s moving now.

Hello Bruna,

Sorry for the late reply.

I find this line of log interesting:

14:23:22.964 WARN: Invalid character encountered in file C:/Temp/geco-2023-v7/geco_personnel/globals.js at line 124 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.

Could you try providing this parameter to your analysis? sonar.sourceEncoding=UTF-8

Best Regards,
Ilia

1 Like

Hello llia
thank you for your response
I added the encoding option as you suggested and now the analysis works fine
Best regards
Bruna

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.