[GH-ISSUE #13] 出现 json 解析失败的情况 #11

Closed
opened 2026-03-13 14:18:21 +03:00 by kerem · 4 comments
Owner

Originally created by @gclm on GitHub (Mar 10, 2026).
Original GitHub issue: https://github.com/7836246/cursor2api/issues/13

错误日志

[Converter] tolerantParse 失败: SyntaxError: Unterminated string in JSON at position 813 (line 5 column 714)
    at JSON.parse (<anonymous>)
    at tolerantParse (/Users/xx/Codes/ai/cursor2api/src/converter.ts:339:21)
    at parseToolCalls (/Users/xx/Codes/ai/cursor2api/src/converter.ts:356:28)
    at handleStream (/Users/xx/Codes/ai/cursor2api/src/handler.ts:506:44)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async handleMessages (/Users/xx/Codes/ai/cursor2api/src/handler.ts:383:13)
Originally created by @gclm on GitHub (Mar 10, 2026). Original GitHub issue: https://github.com/7836246/cursor2api/issues/13 错误日志 ``` [Converter] tolerantParse 失败: SyntaxError: Unterminated string in JSON at position 813 (line 5 column 714) at JSON.parse (<anonymous>) at tolerantParse (/Users/xx/Codes/ai/cursor2api/src/converter.ts:339:21) at parseToolCalls (/Users/xx/Codes/ai/cursor2api/src/converter.ts:356:28) at handleStream (/Users/xx/Codes/ai/cursor2api/src/handler.ts:506:44) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async handleMessages (/Users/xx/Codes/ai/cursor2api/src/handler.ts:383:13) ```
kerem closed this issue 2026-03-13 14:18:27 +03:00
Author
Owner

@7836246 commented on GitHub (Mar 10, 2026):

更新再试试

<!-- gh-comment-id:4029205791 --> @7836246 commented on GitHub (Mar 10, 2026): 更新再试试
Author
Owner

@gclm commented on GitHub (Mar 10, 2026):

还有新的问题

Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=179
[Converter] tolerantParse 失败: SyntaxError: Expected ',' or '}' after property value in JSON at position 5384 (line 5 column 5263)
    at JSON.parse (<anonymous>)
    at tolerantParse (/Users/gclm/Codes/ai/cursor2api/src/converter.ts:389:21)
    at parseToolCalls (/Users/gclm/Codes/ai/cursor2api/src/converter.ts:416:28)
    at handleStream (/Users/gclm/Codes/ai/cursor2api/src/handler.ts:507:44)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async handleMessages (/Users/gclm/Codes/ai/cursor2api/src/handler.ts:384:13)
[Handler] 收到请求: model=anthropic/claude-sonnet-4.6, messages=5, stream=true, tools=6
[Converter] 工具数量: 6, tool_choice: auto
[Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=7
[Handler] 收到请求: model=anthropic/claude-sonnet-4.6, messages=7, stream=true, tools=6
[Converter] 工具数量: 6, tool_choice: auto
[Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=9
[Handler] 收到请求: model=anthropic/claude-sonnet-4.6, messages=9, stream=true, tools=6
[Converter] 工具数量: 6, tool_choice: auto
[Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=11
[Handler] 收到请求: model=anthropic/claude-sonnet-4.6, messages=11, stream=true, tools=6
[Converter] 工具数量: 6, tool_choice: auto
[Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=13
[Converter] tolerantParse 失败: SyntaxError: Expected ',' or '}' after property value in JSON at position 908 (line 5 column 783)
    at JSON.parse (<anonymous>)
    at tolerantParse (/Users/gclm/Codes/ai/cursor2api/src/converter.ts:389:21)
    at parseToolCalls (/Users/gclm/Codes/ai/cursor2api/src/converter.ts:416:28)
    at handleStream (/Users/gclm/Codes/ai/cursor2api/src/handler.ts:507:44)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async handleMessages (/Users/gclm/Codes/ai/cursor2api/src/handler.ts:384:13)
<!-- gh-comment-id:4029619210 --> @gclm commented on GitHub (Mar 10, 2026): 还有新的问题 ``` Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=179 [Converter] tolerantParse 失败: SyntaxError: Expected ',' or '}' after property value in JSON at position 5384 (line 5 column 5263) at JSON.parse (<anonymous>) at tolerantParse (/Users/gclm/Codes/ai/cursor2api/src/converter.ts:389:21) at parseToolCalls (/Users/gclm/Codes/ai/cursor2api/src/converter.ts:416:28) at handleStream (/Users/gclm/Codes/ai/cursor2api/src/handler.ts:507:44) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async handleMessages (/Users/gclm/Codes/ai/cursor2api/src/handler.ts:384:13) [Handler] 收到请求: model=anthropic/claude-sonnet-4.6, messages=5, stream=true, tools=6 [Converter] 工具数量: 6, tool_choice: auto [Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=7 [Handler] 收到请求: model=anthropic/claude-sonnet-4.6, messages=7, stream=true, tools=6 [Converter] 工具数量: 6, tool_choice: auto [Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=9 [Handler] 收到请求: model=anthropic/claude-sonnet-4.6, messages=9, stream=true, tools=6 [Converter] 工具数量: 6, tool_choice: auto [Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=11 [Handler] 收到请求: model=anthropic/claude-sonnet-4.6, messages=11, stream=true, tools=6 [Converter] 工具数量: 6, tool_choice: auto [Cursor] 发送请求: model=anthropic/claude-sonnet-4.6, messages=13 [Converter] tolerantParse 失败: SyntaxError: Expected ',' or '}' after property value in JSON at position 908 (line 5 column 783) at JSON.parse (<anonymous>) at tolerantParse (/Users/gclm/Codes/ai/cursor2api/src/converter.ts:389:21) at parseToolCalls (/Users/gclm/Codes/ai/cursor2api/src/converter.ts:416:28) at handleStream (/Users/gclm/Codes/ai/cursor2api/src/handler.ts:507:44) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async handleMessages (/Users/gclm/Codes/ai/cursor2api/src/handler.ts:384:13) ```
Author
Owner

@7836246 commented on GitHub (Mar 10, 2026):

Image在试一下 错误是 Expected ',' or '}' after property value in JSON at position 5384——这是模型生成的 JSON 里包含了未转义的引号

<!-- gh-comment-id:4029906693 --> @7836246 commented on GitHub (Mar 10, 2026): <img width="517" height="360" alt="Image" src="https://github.com/user-attachments/assets/b57248ab-a5fa-49ed-a210-cad96c05c54a" />在试一下 错误是 Expected ',' or '}' after property value in JSON at position 5384——这是模型生成的 JSON 里包含了未转义的引号
Author
Owner

@gclm commented on GitHub (Mar 10, 2026):

这个问题已经不在出现了,我关闭了

<!-- gh-comment-id:4030032851 --> @gclm commented on GitHub (Mar 10, 2026): 这个问题已经不在出现了,我关闭了
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cursor2api#11
No description provided.