Repository navigation
stats command: SyntaxError: Failed to parse JSON #5431
Description
Description
hello
i guess its a json file that is corrupted somewhere ? Already deleted all json files that failed to parse in my ~/.local/share/opencode:
storage/message/ses_54083ec12ffeOtMmb4yMoQbN5R/msg_abf9864e1001eB66VAVeot7G8k.json storage/part/msg_abf9877a6001iIxq2Vz1WX6WSQ/prt_abf988344001VPHnbczWh0cyDu.json storage/part/msg_abf9877a6001iIxq2Vz1WX6WSQ/prt_abf987e9b001pqZxSRyN6kaOWk.json storage/part/msg_abf9877a6001iIxq2Vz1WX6WSQ/prt_abf987e91001DA63PmoYbDSdm6.json storage/part/msg_abf9864e1001eB66VAVeot7G8k/prt_abf987785001pqOsi6OYgADUOy.json storage/part/msg_abf9864e1001eB66VAVeot7G8k/prt_abf986cd2002mznKM3uYZ1gDy4.json storage/part/msg_abf9864e1001eB66VAVeot7G8k/prt_abf986cd2001Vqqm8Qj92DImxl.json storage/part/msg_abf97a095001VEGhQcBivnTi26/prt_abf9864d9001nw8Iphf4zMzrSF.json storage/part/msg_abf97a095001VEGhQcBivnTi26/prt_abf9864b4001UNgGRZFWcDEKEb.json
but still hapenning.
im sure rm the whole dir would fix it, but i would like to keep my session.
i would have hoped for the log to show which file or what did it fail to parse so i can remove only that.
thanks
OpenCode version
1.0.150
Steps to reproduce
opencode stats
Screenshot and/or share link
❯ opencode --print-logs --log-level DEBUG stats
INFO 2025-12-12T09:39:13 +180ms service=default version=1.0.150 args=["--print-logs","--log-level","DEBUG","stats"] opencode
INFO 2025-12-12T09:39:13 +0ms service=default directory=/home/mirsella/dev/bevy creating instance
INFO 2025-12-12T09:39:13 +1ms service=project directory=/home/mirsella/dev/bevy fromDirectory
INFO 2025-12-12T09:39:13 +6ms service=default directory=/home/mirsella/dev/bevy bootstrapping
INFO 2025-12-12T09:39:13 +2ms service=config path=/home/mirsella/.config/opencode/config.json loading
INFO 2025-12-12T09:39:13 +1ms service=config path=/home/mirsella/.config/opencode/opencode.json loading
INFO 2025-12-12T09:39:13 +0ms service=config path=/home/mirsella/.config/opencode/opencode.jsonc loading
INFO 2025-12-12T09:39:13 +8ms service=bun cmd=["/usr/bin/opencode","add","@opencode-ai/plugin@1.0.150","--exact"] cwd=/home/mirsella/.config/opencode running
INFO 2025-12-12T09:39:13 +3ms service=bun code=0 stdout=bun add v1.3.3 (274e01c7)
installed @opencode-ai/plugin@1.0.150
[1.00ms] done
stderr=Saved lockfile
done
INFO 2025-12-12T09:39:13 +0ms service=plugin path=opencode-gemini-auth@latest loading plugin
INFO 2025-12-12T09:39:13 +17ms service=plugin path=@tarquinen/opencode-dcp@latest loading plugin
INFO 2025-12-12T09:39:13 +48ms service=plugin path=@tarquinen/opencode-smart-title loading plugin
INFO 2025-12-12T09:39:13 +2ms service=bun pkg=@tarquinen/opencode-smart-title version=latest installing package using Bun's default registry resolution
INFO 2025-12-12T09:39:13 +0ms service=bun pkg=@tarquinen/opencode-smart-title version=latest attempt=1 total=3 bun install attempt
INFO 2025-12-12T09:39:13 +0ms service=bun cmd=["/usr/bin/opencode","add","--force","--exact","--cwd","/home/mirsella/.cache/opencode","@tarquinen/opencode-smart-title@latest"] cwd=/home/mirsella/.cache/opencode running
INFO 2025-12-12T09:39:13 +256ms service=bun code=0 stdout=bun add v1.3.3 (274e01c7)
+ @ai-sdk/google@2.0.45
+ @tarquinen/opencode-dcp@0.4.14
+ opencode-anthropic-auth@0.0.5
+ opencode-copilot-auth@0.0.9
+ opencode-gemini-auth@1.2.0
installed @tarquinen/opencode-smart-title@0.1.6
120 packages installed [253.00ms]
stderr=Resolving dependencies
Resolved, downloaded and extracted [1]
Saved lockfile
done
INFO 2025-12-12T09:39:13 +2ms service=plugin path=file:///home/mirsella/.config/opencode/plugin/notify-send.ts loading plugin
INFO 2025-12-12T09:39:13 +1ms service=plugin path=opencode-copilot-auth@0.0.9 loading plugin
INFO 2025-12-12T09:39:13 +0ms service=plugin path=opencode-anthropic-auth@0.0.5 loading plugin
INFO 2025-12-12T09:39:13 +1ms service=bus type=* subscribing
INFO 2025-12-12T09:39:13 +0ms service=bus type=session.updated subscribing
INFO 2025-12-12T09:39:13 +0ms service=bus type=message.updated subscribing
INFO 2025-12-12T09:39:13 +0ms service=bus type=message.part.updated subscribing
INFO 2025-12-12T09:39:13 +0ms service=bus type=session.updated subscribing
INFO 2025-12-12T09:39:13 +0ms service=bus type=message.updated subscribing
INFO 2025-12-12T09:39:13 +0ms service=bus type=message.part.updated subscribing
INFO 2025-12-12T09:39:13 +0ms service=bus type=session.diff subscribing
INFO 2025-12-12T09:39:13 +1ms service=format init
INFO 2025-12-12T09:39:13 +0ms service=bus type=file.edited subscribing
INFO 2025-12-12T09:39:13 +0ms service=lsp LSP server rust is disabled
INFO 2025-12-12T09:39:13 +0ms service=lsp serverIds=deno, typescript, vue, eslint, biome, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, sourcekit-lsp, clangd, svelte, astro, jdtls, yaml-ls, lua-ls, php intelephense, dart, ocaml-lsp, bash, terraform, rust-lspmux enabled LSP servers
INFO 2025-12-12T09:39:13 +0ms service=file.watcher init
INFO 2025-12-12T09:39:13 +1ms service=bus type=command.executed subscribing
INFO 2025-12-12T09:39:13 +1ms service=file.watcher platform=linux backend=inotify watcher backend
INFO 2025-12-12T09:39:13 +6ms service=vcs branch=release-0.16.1 initialized
INFO 2025-12-12T09:39:13 +0ms service=bus type=file.watcher.updated subscribing
ERROR 2025-12-12T09:39:13 +209ms service=acp-command promise={} reason=Bad file descriptor Unhandled rejection
ERROR 2025-12-12T09:39:13 +0ms service=default e=Bad file descriptor rejection
INFO 2025-12-12T09:39:14 +938ms service=default directory=/home/mirsella/dev/bevy disposing instance
INFO 2025-12-12T09:39:14 +0ms service=state key=/home/mirsella/dev/bevy waiting for state disposal to complete
INFO 2025-12-12T09:39:14 +1ms service=bus type=file.watcher.updated unsubscribing
ERROR 2025-12-12T09:39:14 +0ms service=state error=Bad file descriptor key=/home/mirsella/dev/bevy Error while disposing state:
INFO 2025-12-12T09:39:14 +0ms service=state key=/home/mirsella/dev/bevy state disposal completed
ERROR 2025-12-12T09:39:14 +6ms service=default name=SyntaxError message=Failed to parse JSON fatal
Error: Unexpected error, check log file at for more details
SyntaxError: Failed to parse JSON
Operating System
archlinux
Terminal
wezterm
Activity
github-actions commentedon Dec 12, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
rwese commentedon Dec 12, 2025
can't reproduce:
Seems to be caused by a specific session of yours, too bad there isn't enough logging.
This would require using lsof/strace to find the offending session file.
rwese commentedon Dec 12, 2025
i've drafted a small tool to find issues in sessions, maybe this will find the offending file, you could give it a try:
https://github.com/rwese/opencode_session_analyzer
mirsella commentedon Dec 12, 2025
yes I'm sure that's a corruption on my files. thanks a lot for the tool will report back ASAP
mirsella commentedon Dec 12, 2025
opencode session listalso works fine. but i remember having some buggy session and like two disappearing from the session menu in opencode tui, but was listed inopencode session list, and was able to continue using a session using--resume.ill try to use strace but i think its not showing whats happening in other threads/process, ill have to investigate further
mirsella commentedon Dec 12, 2025
big pickle failed but gemini 3 succeeded at finding the problem https://opncd.ai/share/c5MiaR5V multiples files where corrupted:
it added a few try catch which allowed the command to finish without crashing
rekram1-node commentedon Dec 12, 2025
wanna pr the try catch?
mirsella commentedon Dec 12, 2025
will do
goniz commentedon Jan 9, 2026
@rekram1-node What about this issue?
It happened to me locally and I've fixed in in my fork goniz@b4fe936 and then I've found this issue + PR that is month old already
github-actions commentedon Apr 12, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.