You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Copilot returned invalid JSON for commit message generation #22958
Triage summary: This looks like a genuine bug report rather than a duplicate — it's a distinct symptom (strict JSON-parse failure surfaced as an error dialog) from the recently-fixed #22815 (co-author trailer leakage, closed via #22948). I'm suggesting bug and copilot labels, plus more-info-needed since no logs, reproduction steps, or the actual raw Copilot response text were included, which are needed to confirm the root cause.
Initial hypothesis: Commit message generation parses the Copilot model's raw text response with a strict JSON parser in parseCopilotCommitMessage. It first tries to extract a fenced ```json or ``` block via regex, falling back to using the whole trimmed response if no fence is found, then calls JSON.parse on that string and throws "Copilot returned invalid JSON for commit message generation" on any parse failure — matching the exact error text in the reporter's screenshot. Although the system prompt (CommitMessageSystemPrompt in copilot-store.ts) instructs the model to return a raw JSON object with no markdown wrapper, there's no guarantee the model always complies: it could add prose before/after the JSON, use smart quotes, emit unescaped control characters inside string values, or get truncated mid-response (e.g. by a response-size/token limit), any of which would make the parser's regex fail to find a clean match and then fail JSON.parse on whatever remains. Confirming which of these occurred requires the actual raw Copilot response text and/or application log entries from the time of failure, neither of which were attached to this report.
Duplicate check: No duplicate found. #22815 ("intermittently appends extra description and adds Copilot as official co-author") was a different, already-fixed issue — that case produced a successfully-parsed but unwanted co-author trailer, not a parse failure.
To help confirm the cause, it would help to have the application log file from the session where this occurred (Desktop writes these under the app's logs folder) and, if possible, the diff size/content that triggered the generation.
2026-10-02T03:10:57.825Z - warn: [ui] CopilotStore: Failed to generate commit message
Error: Copilot returned invalid JSON for commit message generation
at Ls (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\copilot-commit-message.ts:23:11)
at my.generateCommitMessage (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\copilot-store.ts:1143:14)
at C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\app-store.ts:6393:66
at fy.withIsGeneratingCommitMessage (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\app-store.ts:5412:7)
2026-10-02T03:11:21.497Z - warn: [ui] CopilotStore: Failed to generate commit message
Error: Copilot returned invalid JSON for commit message generation
at Ls (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\copilot-commit-message.ts:23:11)
at my.generateCommitMessage (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\copilot-store.ts:1143:14)
at C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\app-store.ts:6393:66
at fy.withIsGeneratingCommitMessage (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\app-store.ts:5412:7)
I can't reproduce this locally, @frankyuan. Thanks for providing the log! 🙏
This seems like an edge case that may be difficult to isolate, so I need a few more details to see if we can make progress:
Does retrying successfully generate a commit message, or does every attempt fail?
Approximately how long does generation take before the error appears?
Does this happen in every repository or only this repository?
Was there anything notable about the staged files, such as large blobs, a large number of files, unusually large diffs, binary files, or generated content?
Do the same staged changes fail consistently, or was this a one time occurrence?
Anything else specific to the staged changes or repository that might help us reproduce the failure would also be useful.
Thank you for your issue! Unfortunately, we are unable to reproduce the issue you are experiencing. Please provide more information so we can help you.
Here are some tips for writing reproduction steps:
Step by step instructions accompanied by screenshots or screencasts are the best.
Be as specific as possible; include as much detail as you can.
If not already provided, include:
the version of the application you are using.
the operating system you are using
any environment factors you can think of.
any custom configuration you are using.
a log file from the day you experienced the issue (access log files via Help > Show Logs in Finder/Explorer).
If relevant and can be shared, provide the repository or code you are using.
This error isn’t persistent; it happens randomly. Seems like the LLM returns not a valid JSON object. I'm using auto model for commit message generation.
Does retrying successfully generate a commit message, or does every attempt fail?
Randomly, sometime retry worked, but sometimes still fail.
Approximately how long does generation take before the error appears?
5 ~ 10 seconds.
Does this happen in every repository or only this repository?
every repository
Was there anything notable about the staged files, such as large blobs, a large number of files, unusually large diffs, binary files, or generated content?
multiple file changes, but not large blob.
Do the same staged changes fail consistently, or was this a one time occurrence?
I built a local OpenAI-compatible bridge on 127.0.0.1 that forwards GitHub Desktop’s chat request to the Cursor API. API key and model id (including Auto) come from the Desktop provider settings. Same UI, different backend.
I hit the same “Copilot returned invalid JSON for commit message generation” error. That was not an Auto vs Grok thing on my side. Desktop JSON.parses choices[0].message.content and expects:
{"title":"...","description":"..."}
The bridge was returning a plain one-line subject. Once the assistant text is always that JSON object (and a single line from the model is mapped into title with an empty description if needed), generation works, Auto included.
Canceled Copilot anyway. I did not want to keep paying for commit messages while wiring my own fix around the response format.
Thank you for your issue!
We haven't gotten a response to our questions above. With only the information that is currently in the issue, we don't have enough information to take action. We're going to close this but don't hesitate to reach out if you have or find the answers we need. If you answer our questions above, this issue will automatically reopen.
Thank you for your issue!
We haven't gotten a response to our questions above. With only the information that is currently in the issue, we don't have enough information to take action. We're going to close this but don't hesitate to reach out if you have or find the answers we need. If you answer our questions above, this issue will automatically reopen.
Activity
desktop-triage commentedon Oct 2, 2026
Triage summary: This looks like a genuine bug report rather than a duplicate — it's a distinct symptom (strict JSON-parse failure surfaced as an error dialog) from the recently-fixed #22815 (co-author trailer leakage, closed via #22948). I'm suggesting
bugandcopilotlabels, plusmore-info-neededsince no logs, reproduction steps, or the actual raw Copilot response text were included, which are needed to confirm the root cause.Initial hypothesis: Commit message generation parses the Copilot model's raw text response with a strict JSON parser in
parseCopilotCommitMessage. It first tries to extract a fenced```jsonor```block via regex, falling back to using the whole trimmed response if no fence is found, then callsJSON.parseon that string and throws "Copilot returned invalid JSON for commit message generation" on any parse failure — matching the exact error text in the reporter's screenshot. Although the system prompt (CommitMessageSystemPromptincopilot-store.ts) instructs the model to return a raw JSON object with no markdown wrapper, there's no guarantee the model always complies: it could add prose before/after the JSON, use smart quotes, emit unescaped control characters inside string values, or get truncated mid-response (e.g. by a response-size/token limit), any of which would make the parser's regex fail to find a clean match and then failJSON.parseon whatever remains. Confirming which of these occurred requires the actual raw Copilot response text and/or application log entries from the time of failure, neither of which were attached to this report.Duplicate check: No duplicate found. #22815 ("intermittently appends extra description and adds Copilot as official co-author") was a different, already-fixed issue — that case produced a successfully-parsed but unwanted co-author trailer, not a parse failure.
To help confirm the cause, it would help to have the application log file from the session where this occurred (Desktop writes these under the app's logs folder) and, if possible, the diff size/content that triggered the generation.
frankyuan commentedon Oct 2, 2026
The log is in below:
2026-10-02T03:10:57.825Z - warn: [ui] CopilotStore: Failed to generate commit message
Error: Copilot returned invalid JSON for commit message generation
at Ls (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\copilot-commit-message.ts:23:11)
at my.generateCommitMessage (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\copilot-store.ts:1143:14)
at C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\app-store.ts:6393:66
at fy.withIsGeneratingCommitMessage (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\app-store.ts:5412:7)
2026-10-02T03:11:21.497Z - warn: [ui] CopilotStore: Failed to generate commit message
Error: Copilot returned invalid JSON for commit message generation
at Ls (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\copilot-commit-message.ts:23:11)
at my.generateCommitMessage (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\copilot-store.ts:1143:14)
at C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\app-store.ts:6393:66
at fy.withIsGeneratingCommitMessage (C:\Users*\AppData\Local\GitHubDesktop\app-3.6.6\webpack:\app\src\lib\stores\app-store.ts:5412:7)
babakks commentedon Oct 6, 2026
I can't reproduce this locally, @frankyuan. Thanks for providing the log! 🙏
This seems like an edge case that may be difficult to isolate, so I need a few more details to see if we can make progress:
Anything else specific to the staged changes or repository that might help us reproduce the failure would also be useful.
github-actions commentedon Oct 6, 2026
Thank you for your issue! Unfortunately, we are unable to reproduce the issue you are experiencing. Please provide more information so we can help you.
Here are some tips for writing reproduction steps:
Help>Show Logs in Finder/Explorer).frankyuan commentedon Oct 7, 2026
This error isn’t persistent; it happens randomly. Seems like the LLM returns not a valid JSON object. I'm using
automodel for commit message generation.Does retrying successfully generate a commit message, or does every attempt fail?
Approximately how long does generation take before the error appears?
Does this happen in every repository or only this repository?
Was there anything notable about the staged files, such as large blobs, a large number of files, unusually large diffs, binary files, or generated content?
Do the same staged changes fail consistently, or was this a one time occurrence?
sergiou87 commentedon Oct 14, 2026
Could you try 3.6.7? It has a newer version of Copilot SDK inside which improves the
automodel experience 🤞ElCanu commentedon Oct 16, 2026
I still have the same bug wih 3.6.7.. its rng but now i cant get pass this error somehow,..
ElCanu commentedon Oct 16, 2026
It does that on Auto, switched to Grok 4.7 and my commits message generation are working now
ElCanu commentedon Oct 16, 2026
I built a local OpenAI-compatible bridge on 127.0.0.1 that forwards GitHub Desktop’s chat request to the Cursor API. API key and model id (including Auto) come from the Desktop provider settings. Same UI, different backend.
I hit the same “Copilot returned invalid JSON for commit message generation” error. That was not an Auto vs Grok thing on my side. Desktop JSON.parses choices[0].message.content and expects:
{"title":"...","description":"..."}
The bridge was returning a plain one-line subject. Once the assistant text is always that JSON object (and a single line from the model is mapped into title with an empty description if needed), generation works, Auto included.
Canceled Copilot anyway. I did not want to keep paying for commit messages while wiring my own fix around the response format.
github-actions commentedon Oct 28, 2026
Thank you for your issue!
We haven't gotten a response to our questions above. With only the information that is currently in the issue, we don't have enough information to take action. We're going to close this but don't hesitate to reach out if you have or find the answers we need. If you answer our questions above, this issue will automatically reopen.
github-actions commentedon Nov 11, 2026
Thank you for your issue!
We haven't gotten a response to our questions above. With only the information that is currently in the issue, we don't have enough information to take action. We're going to close this but don't hesitate to reach out if you have or find the answers we need. If you answer our questions above, this issue will automatically reopen.