opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Nix build fails when shell completion generation produces empty output

Open jerome-benoit opened this issue 14 hours ago • 1 comments

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 completion command 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:

  1. Capturing completion output before installation
  2. Adding error handling with `|| true`
  3. Only installing completions if they contain actual content
  4. Using safe piping to avoid empty file errors

jerome-benoit avatar Jan 18 '26 21:01 jerome-benoit