opencode
opencode copied to clipboard
Nix build fails when shell completion generation produces empty output
Problem
The Nix build fails with the following error:
ERROR: installShellCompletion: installed shell completion file does not exist or has zero size
This occurs when:
- The
opencode completioncommand fails or returns empty output during the build - bash or zsh shells are not installed in the build environment
Expected Behavior
The Nix build should succeed even if shell completions cannot be generated. Shell completions are optional and their absence should not prevent the package from being built.
Proposed Solution
Make the shell completion installation resilient to failures by:
- Capturing completion output before installation
- Adding error handling with `|| true`
- Only installing completions if they contain actual content
- Using safe piping to avoid empty file errors