fix(config): handle write errors when updating schema in opencode config #8125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
fixes #8126
when opencode launches it will try to add
"$schema": "https://opencode.ai/config.json"if it is not already thereIf opencode is unable to write to config it crashes with this error
ran into this since my config is syslinked from nix-store and you cant write to nix-store
Could add logging to this, but since i don't think its a big issue it's best to just ignore.
alternatively instead of the error above you could show a nicer warning saying
failed to add "$schema": "https://opencode.ai/config.json"to prompt the user to update their config manuallyHow did you verify your code works?
I looked at it
... fine i'll test it... , ran bun dev; launches fine with misconfigured config