Skip to content

out-of-range Integer in response data to "textDocument/semanticTokens/full" #2736

Description

@jansorg

Swift version

Swift version 6.3.3 (swift-6.3.3-RELEASE)

Platform

Linux

Editor

Noctule (my own LSP client, uses LSP4J)

Description

  1. I used SourceKit LSP with Objective-C
  2. I opened CocoaLumberjack/CLI/CLIColor.m of https://github.com/cocoalumberjack/cocoalumberjack
  3. The LSP client requested semantic tokens

LSP4J failed to deserialize the reponse, because one of the numbers (which should be uint32 (2^31-1) according to the LSP spec) was out-of-range.

The out-of-range number is 4294967295, which is 2^32 − 1 and at the position of a delta line. Claude says it might be "-1" converted to an uint32.
Perhaps lines with a negative delta should be ignored from the response?

This was the log captured by SourceKit LSP.
I'm unable to reproduce this reliably, it only happens sometimes.

Steps to Reproduce

  1. I used SourceKit LSP with Objective-C
  2. I opened CocoaLumberjack/CLI/CLIColor.m of https://github.com/cocoalumberjack/cocoalumberjack
  3. The LSP client requested semantic tokens

I'm not able to reproduce this reliably, but have seen it a few times already.

Logging

--[org.swift.sourcekit-lsp:request-39] default 2026-07-27 10:54:56.9940 +0200
Received request "39": textDocument/semanticTokens/full
{
  "textDocument" : {
    "uri" : "file:///home/user/test-sources/test-sources/CocoaLumberjack/Sources/CocoaLu
mberjack/CLI/CLIColor.m"
  }
}
---[org.swift.sourcekit-lsp:request-39] info 2026-07-27 10:54:56.9940 +0200
Sending request to clangd (id: "sk-35"):
textDocument/semanticTokens/full
{
  "textDocument" : {
    "uri" : "file:///home/user/test-sources/test-sources/CocoaLumberjack/Sources/CocoaLumberjack/CLI/CLIColor.m"
  }
}
---[org.swift.sourcekit-lsp:clangd-stderr] info 2026-07-27 10:54:56.9940 +0200
I[10:54:56.994] <-- textDocument/semanticTokens/full("sk-35")

---[org.swift.sourcekit-lsp:clangd-stderr] info 2026-07-27 10:54:56.9940 +0200
I[10:54:56.994] --> reply:textDocument/semanticTokens/full("sk-35") 0 ms

---[org.swift.sourcekit-lsp:default] info 2026-07-27 10:54:56.9940 +0200
Received reply for request "sk-35" from clangd
textDocument/semanticTokens/full
Optional<DocumentSemanticTokensResponse>
{
  "data" : [
    18,
    0,
    0,
    24,
    0,
    1,
    0,
    36,
    24,
    0,
    4294967295,
    0,
    0,
    24,
    0,
    1,
    0,
    36,
    24,
    0,
    1,
    0,
    0,
// ... snipped

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions