swiftlang / swiftlang/sourcekit-lsp

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

Open
#2,736 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
3.9k
Forks
390
Avg merge
9d 5h
Merged PRs (30d)
3

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the textDocument/semanticTokens/full response path in SourceKit-LSP, using the logged request for CLIColor.m and the clangd reply as the reproduction context. Check how the semantic-token data is validated or forwarded, then confirm that responses containing 4294967295 are handled correctly with a regression test or a reliable reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, swift
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.