JSON Parse error: Unterminated string with openrouter/kimi-k2 #895

Closed
opened 2026-02-16 17:28:42 -05:00 by yindo · 1 comment
Owner

Originally created by @esafak on GitHub (Jul 24, 2025).

Originally assigned to: @thdxr on GitHub.

ls.initializeParams.getRootPath\n    pathRelativeToRoot =
fileUri.tryRelativeTo(rootPath)\n    mappings =
ls.getWorkspaceConfiguration.await().projectMapping.get(@[])\n\n  if
pathRelativeToRoot.isSome:\n    for mapping in mappings:\n      var m: RegexMatch2\n
if find(pathRelativeToRoot.get(), re2(mapping.fileRegex), m):\n        ls.showMessage(\n
fmt\"RegEx matched `{mapping.fileRegex}` for file `{fileUri}`\", MessageType.Info\n
)\n        result = string(rootPath) / mapping.projectFile\n        if
fileExists(result):\n          trace \"getProjectFile?\",\n            project = result,
uri = fileUri, matchedRegex = mapping.fileRegex\n          return result\n      else:\n
trace \"getProjectFile does not match\",\n          uri = fileUri, matchedRegex =
mapping.fileRegex\n\n  #If we reached the maximum instances of nimsuggest, we just return
the first project\n  let shouldSpawn = await ls.shouldSpawnNimsuggest()\n  if not
shouldSpawn:\n    result = ls.projectFiles.keys.toSeq[0]\n    debug \"Reached the maximum
instances of nimsuggest, reusing the first nimsuggest instance\", project = result\n
return result\n\n  result = await ls.getProjectFileAutoGuess(fileUri)\n  if result in
ls.projectFiles:\n    let ns = await ls.projectFiles[result].ns\n    let isKnown = await
ns.isKnown(fileUri)\n    if ns.canHandleUnknown and not isKnown:\n      debug \"File is
not known by nimsuggest\", uri = fileUri, projectFile = result\n      result =
fileUri\n\n  debug \"getProjectFile \", project = result, fileUri = fileUri",
"newString": "proc getProjectFile*(fileUri: string, ls: LanguageServer): Future[string]
{.async.} =\n  let\n    rootPath = ls.initializeParams.getRootPath\n
pathRelativeToRoot = fileUri.tryRelativeTo(rootPath)\n    mappings =
ls.getWorkspaceConfiguration.await().projectMapping.get(@[])\n\n  # First, check
projectMapping for exact matches\n  for mapping in mappings:\n    var m: RegexMatch2\n
let filePath = fileUri.uriToPath\n    \n    # Check if file matches the regex pattern.
Error message: JSON Parse error: Unterminated string
Originally created by @esafak on GitHub (Jul 24, 2025). Originally assigned to: @thdxr on GitHub. ``` ls.initializeParams.getRootPath\n pathRelativeToRoot = fileUri.tryRelativeTo(rootPath)\n mappings = ls.getWorkspaceConfiguration.await().projectMapping.get(@[])\n\n if pathRelativeToRoot.isSome:\n for mapping in mappings:\n var m: RegexMatch2\n if find(pathRelativeToRoot.get(), re2(mapping.fileRegex), m):\n ls.showMessage(\n fmt\"RegEx matched `{mapping.fileRegex}` for file `{fileUri}`\", MessageType.Info\n )\n result = string(rootPath) / mapping.projectFile\n if fileExists(result):\n trace \"getProjectFile?\",\n project = result, uri = fileUri, matchedRegex = mapping.fileRegex\n return result\n else:\n trace \"getProjectFile does not match\",\n uri = fileUri, matchedRegex = mapping.fileRegex\n\n #If we reached the maximum instances of nimsuggest, we just return the first project\n let shouldSpawn = await ls.shouldSpawnNimsuggest()\n if not shouldSpawn:\n result = ls.projectFiles.keys.toSeq[0]\n debug \"Reached the maximum instances of nimsuggest, reusing the first nimsuggest instance\", project = result\n return result\n\n result = await ls.getProjectFileAutoGuess(fileUri)\n if result in ls.projectFiles:\n let ns = await ls.projectFiles[result].ns\n let isKnown = await ns.isKnown(fileUri)\n if ns.canHandleUnknown and not isKnown:\n debug \"File is not known by nimsuggest\", uri = fileUri, projectFile = result\n result = fileUri\n\n debug \"getProjectFile \", project = result, fileUri = fileUri", "newString": "proc getProjectFile*(fileUri: string, ls: LanguageServer): Future[string] {.async.} =\n let\n rootPath = ls.initializeParams.getRootPath\n pathRelativeToRoot = fileUri.tryRelativeTo(rootPath)\n mappings = ls.getWorkspaceConfiguration.await().projectMapping.get(@[])\n\n # First, check projectMapping for exact matches\n for mapping in mappings:\n var m: RegexMatch2\n let filePath = fileUri.uriToPath\n \n # Check if file matches the regex pattern. Error message: JSON Parse error: Unterminated string ````
yindo closed this issue 2026-02-16 17:28:42 -05:00
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#895