Skip to content

fails to write markdown because of JSON validation #393

Closed

Description

@rbavery

Describe the bug

I asked it to dump it's comments of our chat to a file.

result

 > dump your comments to a file in rustac folder

 ✗ Execution failed: Expected ',' or '}' after property value in JSON at position 65 (line 1 column 66)

 > save markdown of your recommendations to a folder

 ✗ Execution failed: Expected ',' or '}' after property value in JSON at position 73 (line 1 column 74)

Affected version

→ copilot --version 0.0.350 Commit: 6bd4106

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Activity

  1. added theissue type on Oct 24, 2025
  2. sergiou87 commented on Oct 24, 2025

    @sergiou87
    Member

    I cannot reproduce this. Can you share logs or more context of that conversation? 🙏

    Thank you!

  3. yaananth commented on Nov 2, 2025

    @yaananth

    I faced this multiple times...though sporadic..will try to capture some logs

    But def happens..usually saying "continue" or "Retry" seemes like worked for me

  4. EnriqueGF commented on Nov 2, 2025

    @EnriqueGF

    Same.

    ✓ Find getEntityFromLogEntry function
       $ grep -n "getEntityFromLogEntry" /home/enrique/xx/resources/js/game -r --include="*.ts" | head -5
       ↪ 6 lines...
    
     ✗ Execution failed: Expected ',' or '}' after property value in JSON at position 218 (line 1 column 219)
    
  5. autonomousit commented on Nov 4, 2025

    @autonomousit

    @sergiou87 - Personally I encountered this when using non-interactive mode and a very long running task. My assumption is GHCP CLI tried to ask for permission to continue or something like that but error-ed out after a couple of minutes instead with the below. Chat output was a few minutes before the error and then I just get the request stats summary output afterwards (you can see it was a pretty long request ).

    copilot --version
    0.0.354
    Commit: 076bd172b

    Perfect! Now I have a complete understanding of the codebase. Let me create a comprehensive, machine-readable implementation plan with atomic phases and executable tasks.
    Execution failed: Expected ',' or '}' after property value in JSON at position 81 (line 1 column 82)
    
    Total usage est:       1 Premium request
    Total duration (API):  4m 44.5s
    Total duration (wall): 4m 50.2s
    Total code changes:    0 lines added, 0 lines removed
    Usage by model:
        claude-sonnet-4.5    561.4k input, 17.6k output, 0 cache read, 0
      cache write (Est. 1 Premium request)

    I was doing a development planning task similar to:

    copilot -p "Plan this really big task with lots of context and save the plan in plan.md" --allow-all-tools

    When I changed the prompt to allow for incremental outputs it succeeded. Something like:

    copilot -p "Plan this really big task with lots of context and for each phase in the plan save it in phase_<number>.md" --allow-all-tools

    Hopefully the long running request gives you a reproducible condition to track down the root cause.

  6. sergiou87 commented on Nov 4, 2025

    @sergiou87
    Member

    Thank you very much!! 💖

    I've been trying this for a long time today and haven't been able to reproduce this. Not sure what could be going on here 😢 I made it generate lots of markdown files, longer and shorter, with JSON, JS code, just text… no luck so far 😢

  7. autonomousit commented on Nov 5, 2025

    @autonomousit

    @sergiou87 - thanks for the effort on this. From your last comment I'm worried I didn't explain clearly. The trigger for me seemed to be holding on one single file creation task for ~4-5 mins, nothing on the actual number of chars, etc but more the fact that a specific file generation task wasn't completing. As soon as I got it to incrementally output smaller files that all completed relatively quickly then it was fine even though the overall request "session" time was the same or longer. Hope that is more specific

  8. sergiou87 commented on Nov 5, 2025

    @sergiou87
    Member

    Thanks for your clarification! I managed to repro it with this prompt:

    Study this codebase and create a very long plan.md file with at least 300 suggestions of big potential tasks with big context, don't be scarce in words. Make sure to include JavaScript and JSON examples where appropriate. Use headings and subheadings where appropriate. Format the file using markdown syntax. The file should be named PLAN.md. Duplicate every paragraph. Again, write a very long file!!!! Write as much as you can per task.
    

    Let's see if I can find why 🕵️

    EDIT: The problem I see is the LLM is returning an incorrect JSON that we assume is correct. In my case, it was the JSON where the path of the PLAN.md file is specified, which is supposed to be an object, but the last curly brace is missing 😬

  9. self-assigned this
    on Nov 5, 2025
  10. sergiou87 commented on Nov 6, 2025

    @sergiou87
    Member

    👋 Just FYI I've submitted a fix that prevents the "Execution failed" error but not the actual problem (getting an invalid JSON from the LLM). What this means is that the app might run into this problem again, but instead of stopping, the agent will get to know about the error you ran into, and try other ways to create the file.

    I know it's not optimal, but I'll work with the right team about the JSON issue separately, since it's not a problem of the app itself.

    In any case, this is how the app should behave with such errors: get back to the LLM with the error as new context and let it work around it 🤞

  11. sergiou87 commented on Nov 6, 2025

    @sergiou87
    Member

    Well, I've got confirmation that this is a problem of the LLM, so I'm afraid the only actual fix for this will come from the model itself 😓

    I can only advice to try with another model, if my fix/workaround is not enough whenever you encounter this error.

    Sorry I can't be of more help!!

  12. autonomousit commented on Nov 7, 2025

    @autonomousit

    Thanks for the detailed debrief @sergiou87, appreciate it

  13. removed their assignment
    on Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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