Skip to content

Getting a json parse error on the prompt history and/or token error #4277

Closed

Description

@ubuntupunk

Description

After a sudden shutdown, getting a json parse error for the prompt history, have tried removing and reinstalling, deleting the local and global config files, but no luck.

OpenCode version

1.0.62

Steps to reproduce

Run Opencode

Syntax error ' token unknown, see attachment

Screenshot and/or share link

Image

Operating System

Ubuntu 24.04

Terminal

Gnome Terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 13, 2025
  2. github-actions commented on Nov 13, 2025

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case with prompt history JSON parse errors.

  3. ubuntupunk commented on Nov 13, 2025

    @ubuntupunk
    Author

    Here is the fix:
    rm -rf ~/.local/state/opencode

    Had to grep my entire home directory to find opencode is setting state under this directory.

  4. rekram1-node commented on Nov 13, 2025

    @rekram1-node
    Contributor

    Hm I wonder what happened

  5. ubuntupunk commented on Nov 14, 2025

    @ubuntupunk
    Author

    Seems like a corrupted state management file caused by an unscheduled shutdown. There should be a check on the file to avoid this, before instantiating the state history?

  6. rekram1-node commented on Nov 14, 2025

    @rekram1-node
    Contributor

    yeah I think the tui state prolly got corrupted

  7. marklise commented on Nov 15, 2025

    @marklise

    @rekram1-node, I had the same situation as @ubuntupunk. In my case, the history got corrupted as the partition that opencode stores ~/.local/state/opencode/prompt-history.jsonl temporarily ran out of space. From that point forward, opencode just kept writing json into that history file so it was never going to fix itself. I simply deleted the offending json line, wrote the file, restarted and retained my prompt history and everything is back to normal.

  8. self-assigned this
    on Nov 16, 2025
  9. rekram1-node commented on Nov 16, 2025

    @rekram1-node
    Contributor

    next release should fix both of ur issues, for whatever reason we werent capping out # of entries to that file, now it wont grow forever lol

    also introduced better error handling

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 workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions