| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
When a session JSON file is empty or contains invalid JSON, the entire session list fails to load with 'Unexpected end of JSON input' error. This causes all sessions to appear missing even though valid session files exist. This fix adds try-catch blocks to the list() and children() functions to gracefully skip corrupted session files instead of failing the entire operation. A warning is logged for each skipped file to help users identify and clean up corrupted files. Fixes the issue where a single corrupted session file prevents all sessions from being displayed.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Sorry, something went wrong.
|
The following comment was made by an LLM, it may be inaccurate: Based on my search results, I found several related PRs that address similar JSON parsing and error handling issues: Potential Related PRs:
Note: PR #7888 is particularly relevant as it appears to address the exact same issue (empty JSON files) at the storage layer, which may overlap with the scope of PR #8825. |
Sorry, something went wrong.
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
When a session JSON file is empty or contains invalid JSON, the entire session list fails to load with Unexpected end of JSON input error. This causes all sessions to appear missing even though valid session files exist.
Problem
Root Cause
The list() and children() functions in packages/opencode/src/session/index.ts don't handle JSON parsing errors:
Solution
Add try-catch blocks to gracefully skip corrupted session files:
Testing
Manually tested by:
Related
This addresses the scenario described in logs like: