SonarJS 14.3: invalid UTF-8 Protobuf errors; PR analysis times out before upload

Environment

  • SonarQube Cloud pull-request analysis of a private TypeScript/JavaScript monorepo
  • SonarScanner CLI 8.2.0.6438
  • SonarJS 14.3.0.46350, implementation build 822582ba4369505b8701de3c4a0029e7f769e93a
  • Node.js 22.23.4 on macOS arm64, explicitly selected by sonar.nodejs.executable
  • sonar.javascript.node.maxspace=8192; scanner reported Node memory 8240 MB
  • Engine Java 21.0.12.1
  • 9,579 files indexed; 29 TypeScript configurations resolved

Observed behavior

The JavaScript/TypeScript/CSS sensor initialized successfully, started its gRPC analyze-project server, and resolved all 29 configurations. About 9 minutes 39 seconds after sensor start it logged the first of seven errors:

ERROR Failed to deserialize Protobuf message: Protocol message had invalid UTF-8.

The seven errors spanned about 97 seconds. The final scanner log line was the seventh error. Our external bounded-run watchdog stopped the still-running analysis about 63 seconds later at its predeclared 900-second wrapper deadline. Node and both Java processes were still present in the final retained observation. No report-task.txt, client report upload, or compute-engine task was produced.

Node RSS peaked at 1,701,840 KiB and was 970,080 KiB in the final observation, well below the configured 8,240 MB value. System free-memory samples never approached our 12% stop threshold (minimum 36%). There was no OOM or heap-limit message.

Three earlier scanner warnings naming invalid UTF-8 source lines were investigated separately. All three files strictly decode as UTF-8, and the named lines deliberately contain the literal U+FFFD replacement character encoded as valid EF BF BD. They predate the JavaScript sensor and do not appear to identify the Protobuf payload.

Minimal codec-component reproduction

We isolated the exact protobuf UTF-8 module from the retained SonarJS server.cjs without starting the analyzer server. The module writes a lone high surrogate U+D800 as ED A0 80, then its strict UTF-8 reader rejects those bytes. A literal U+FFFD writes as EF BF BD and round-trips successfully. This shows a codec-level mechanism but is not a full AST reproduction and does not identify which source file or protobuf field caused our seven errors.

We can provide the separately reviewed path-free synthetic codec reproduction and receipt, the plugin manifest, and a sanitized scanner log. We cannot provide private source code. The internal exact-bundle verification script contains local paths and source filenames and must not be attached. The path-free candidate mirrors the observed codec algorithm but does not execute the exact bundle, identify a failed payload, or prove a timeout cause.

Questions

  1. Is there a supported way in SonarJS 14.3 to correlate Failed to deserialize Protobuf message with a source path, AST type, or protobuf field without exposing source code?
  2. Does SonarJS 14.3 deliberately skip an AST after this exception and continue, making the message non-fatal, or can it leave the sensor unable to finish?
  3. Is the bundled writer’s handling of lone UTF-16 surrogates a known issue, and is there a fixed SonarJS build or supported configuration?
  4. What supported progress diagnostics can distinguish a slow but healthy analysis from a stalled one in this phase?
  5. Is there any server-side record available when no client report was uploaded and no report-task.txt was created?

Available sanitized evidence

  • Sanitized scanner log SHA-256: 0e76f2aa3638136334cbddc96c9b15ca4d81d8077875ede34833e8754ec65611

  • SonarJS plugin JAR SHA-256: dfcdc925ca7d42711ef263a2472f48d08630d7c454aa4242b50980e62f9c1f25

  • Bundled server.cjs SHA-256: 2cf40006fa7369cee554d1ed8e51e094b1fe7355b47ac409047b0c3879728795

  • Isolated codec module SHA-256: 38402270e8e10a227c2b3e5f43f65f967569cd2edb9f52110b28cc54fe683a39

  • Reproduction source SHA-256: c5614897509ef40a1e21c93ecf4be57a1faf91163da4a60f0470211449432a4b

  • Path-free synthetic attachment SHA-256: f4957faf1babac76c1a50bb07945ce93ab1878c54819cb30c385ee402a4ae100

  • Path-free synthetic receipt SHA-256: 525fe15064c4bcb8b8752aa1d80545ab25794f34ceac27904dd2d69ec77d3215

    SONARSOURCE-CODEC-REPRO.zip (1.1 KB)

Hi @planetb2b,

Thanks for the detailed report. We reproduced the protobuf error with valid source code and created JS-2753 to fix it. We could reproduce this with const s = "\uD800";, which contains only ASCII characters. There is a matching upstream protobuf.js bug with an open fix proposal. We will monitor it and try to have a fix ASAP.

SonarJS 14.3 does not include the file path or AST field in this error. Debug logs can help narrow the search, but they cannot reliably identify the failed file.

In any case, this error should not stop the analysis and does not explain the timeout. The normal JavaScript and TypeScript checks still run. However Taint analysis (the consumer of that protobuf-encoded AST) can miss results. This can include flows between files. To investigate further, would it be possible for you to share debug logs (running the scanner with -X)? Please remove sensitive information or I can write you a PM if you prefer.

If no analysis report reached SonarQube Cloud, there is no analysis result to inspect AFAIK.

Cheers!