Quick answer
Find the data directory first: `~/.local/share/opencode` on macOS and Linux, `%APPDATA%\opencode` on Windows, or under `XDG_DATA_HOME`. If it is empty, OpenCode has not written a session or is using another path. If it has data, the reader is pointed at the wrong file or the wrong schema version.
Five causes
XDG_DATA_HOMEis set, so the data is not in the default folder.- The app is pointed at
storage/while the version usesopencode.db. - The session is still open and the final fields are not written yet.
- A container or WSL install writes to a different filesystem.
- File permissions block the reader under another user account.
Check the path
echo $XDG_DATA_HOME
ls -la ~/.local/share/opencode
ls -la ~/.local/share/opencode/storage 2>/dev/nullOn Windows, check %APPDATA%\opencode and %LOCALAPPDATA%\opencode. A version upgrade can move or rename the database, so list the folder rather than assuming a filename.
Fix and verify
- Point the tracker at the folder, not at a guessed file.
- Restart the app after changing the path.
- Open one session and confirm the token fields exist.
- If the schema changed, update the tracker or use the app's newest build.
When OpenCode usage does not appear
| Symptom | Cause | Fix |
|---|---|---|
| Empty dashboard | Wrong data directory | Point the tracker at the right path |
| Old totals | Database locked or cached | Restart, then refresh |
| Missing recent sessions | CLI running in a container | Mount or copy the database |
| Costs at zero | No cost field in messages | Use token-based estimates |
| Partial models | Provider returned no usage | Check the provider response |
Start with the path, because it explains most cases. The database location guide lists the defaults, and UsageAtlas reports which source it read.
Questions, answered
Why does OpenCode show no usage after an update?
The storage format may have changed between JSON files and SQLite. Point the reader at the current data folder and check for a database file.
Does OpenCode delete old sessions?
Not automatically in most versions. Cleanup scripts and reinstalls can remove them.
Can I recover missing OpenCode usage?
Only from a backup of the data folder. Once the records are gone, the token history is gone.