Skip to content

Can't use Claude Opus 4.5 on opencode using Github Copilot #6281

Closed

Description

@bhadraagada01

Description

This is the error i get when im trying to use claude opus 4.5 with github copilot

⚙ invalid [tool=write, error=Invalid input for tool write: JSON parsing failed: Text: {"filePath": "C:\\Users\\LENOVO\\Desktop\\ntfsnap\\ntfsnap.py".
Error message: JSON Parse error: Expected '}']
Image

and it takes ages to a response out of it and also and it gets endless stuck at preparing write

OpenCode version

1.0.204

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Powershell

Activity

  1. github-actions commented on Dec 28, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    All of these report the same JSON parsing error when using the write tool with Claude Opus models (4.1 and 4.5). The error appears to be incomplete JSON being generated with missing closing braces.

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

    can u run this and send me file?

    opencode export > session.json

  3. bhadraagada01 commented on Dec 29, 2025

    @bhadraagada01
    Author

    this is only happening when i try with python related project, it works fine with my ts project but ill still give you the session.json

    session-ses_49c3.json
    session-ses_49c3.md

  4. aaronkyriesenbach commented on Jan 16, 2026

    @aaronkyriesenbach

    I am also running into this issue specifically for Python code - no issues if I work with projects in other languages or specify that the agent shouldn't write any Python code.

  5. rekram1-node commented on Jan 16, 2026

    @rekram1-node
    Contributor

    @aaronkyriesenbach are u on windows too? Any chance u can send me a session export^^^

  6. aaronkyriesenbach commented on Jan 16, 2026

    @aaronkyriesenbach

    Nope, tested on both macOS and Linux. Here is a prompt that causes the error on both systems:

    I'm building a deep learning model to denoise audio. I have ~5000 hours of each type, noisy and denoised, and many recordings are of the same content but not synchronized.
    In a previous session, we designed:
    1. An audio pairing pipeline (fingerprinting → coarse alignment via cross-correlation → fine alignment via DTW → quality verification)
    2. A Conformer-UNet generator with attention-gated skip connections operating on complex spectrograms
    3. A multi-scale PatchGAN discriminator
    4. A hybrid training strategy using paired data (supervised losses) and unpaired data (adversarial losses)
    5. A phased training schedule
    Please write a comprehensive markdown guide to `$HOME/audio_enhancement_guide.md` that includes:
    - Complete preprocessing pipeline with technical details
    - Audio pairing and alignment procedures
    - Model architecture specifications
    - Training configuration and loss functions
    - Verification steps to validate preprocessing quality
    - Verification steps to validate training efficacy
    - Evaluation metrics and interpretation
    - Troubleshooting guide
    Make it detailed enough to serve as a complete implementation reference.
    

    And here are the session logs from each system:

    macos_session.json
    linux_session.json

    Updating the above prompt to specify that Python code should not be written results in a successful write:

    In a previous session, we designed:
    1. An audio pairing pipeline (fingerprinting → coarse alignment via cross-correlation → fine alignment via DTW → quality verification)
    2. A Conformer-UNet generator with attention-gated skip connections operating on complex spectrograms
    3. A multi-scale PatchGAN discriminator
    4. A hybrid training strategy using paired data (supervised losses) and unpaired data (adversarial losses)
    5. A phased training schedule
    Please write a comprehensive markdown guide to `$HOME/audio_enhancement_guide.md` that includes:
    - Complete preprocessing pipeline with technical details
    - Audio pairing and alignment procedures
    - Model architecture specifications
    - Training configuration and loss functions
    - Verification steps to validate preprocessing quality
    - Verification steps to validate training efficacy
    - Evaluation metrics and interpretation
    - Troubleshooting guide
    Make it detailed enough to serve as a complete implementation reference. Do not include any Python code in the file.
    

    Here's the successful session:

    working_session.json

    Hopefully this is helpful! Please let me know if there's any other info that I can provide to help troubleshoot. Thanks for your help with this!

  7. nalejandroveron commented on Jan 17, 2026

    @nalejandroveron

    It seems that the error is always the same, the model forgets to close the JSON? I'm seeing the same now in MacOS python too

  8. tyrailleverett commented on Jan 17, 2026

    @tyrailleverett

    I am having the same issue with Claude Sonnet 4.5, Claude Haiku 4.5 using Github Copilot. However, I am not using Python. I am getting the error just trying to create a markdown file. I am on the latest opencode and have removed my Github Copilot auth and re-auth. Still same issue. I should point out I am on Mac.

  9. tyrailleverett commented on Jan 17, 2026

    @tyrailleverett

    Just an update, I came across this issue: #5890, which suggested the error occurs when the model is trying to generate too large of a file, which lines up with the file I was trying to generate. Otherwise, the models work just fine, so it seems when the file is too large (possibly overfilling the smaller context window that Github Copilot provides ) then this error is thrown.

  10. EchoCyan commented on Jan 27, 2026

    @EchoCyan

    same issue, using github-copilot/claude-opus-4.5 will get endless stuck at preparing write

  11. hyperbolic-c commented on Jan 30, 2026

    @hyperbolic-c

    same issue, but gpt-5.1-codex work.

    Image
  12. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions