GeezerVison is showing github.com — fix: Enhance clipboard error handling by propagating errors and checking command exit codes by ErvisTusha · Pull Request #7220 · anomalyco/opencode
Conversation
ErvisTusha
commented
Jan 7, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Overview
This pull request improves clipboard functionality by enhancing error handling across all platforms, with particular focus on Linux systems. The changes ensure that clipboard operations properly propagate errors and provide meaningful feedback to users when issues occur.
Changes
1. Clipboard.ts (util/clipboard.ts)
- Linux Wayland support: Added proper detection for Wayland environments via
WAYLAND_DISPLAY environment variable
- Exit code validation: Added checks for command exit codes (0 means success) for all clipboard tools:
wl-copy (Wayland)
xclip (X11)
xsel (X11)
- Improved error handling: Tools now throw descriptive errors when clipboard operations fail, instead of silently failing
- Better error messages: Specific error messages indicate which tool failed and what to install if tools are missing
2. App.tsx (ui/app.tsx)
- Error propagation: Updated clipboard.copy() calls to properly handle errors
- User feedback: Added error toast notifications when clipboard operations fail
- Graceful degradation: Users are informed when copy operation fails instead of silent failure
Technical Details
- Changed from
.catch(() => {}) (silent failures) to .catch((error) => { ... }) (proper error handling)
- Exit codes are now properly checked for spawned processes
- Error messages clearly indicate the issue and suggest resolution steps
Testing
- Tested clipboard copy on Linux with Wayland
- Tested clipboard copy on Linux with X11
- Tested clipboard copy on Windows
- Tested clipboard copy on macOS
- Verified error messages display correctly when tools are missing
Related Issues
Closes #[issue-number] (if applicable)
Checklist
- Changes follow the project's contributing guidelines
- Code is properly formatted
- Error handling is comprehensive
- User-facing messages are clear and helpful
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
… command exit codes, and providing specific messages when tools are missing.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
fixed for 1.1.6 Linux/Ubuntu
|
Rhiz3K reacted with thumbs up emoji
Rhiz3K reacted with eyes emoji
All reactions
-
👍
1 reaction
-
👀
1 reaction
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.