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 2 days 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

This issue might be a duplicate of or related to existing issues. Please check:

  • #8962: Desktop build on nixos - Direct Nix build failure with IPC requests
  • #5914: NixOS: custom tools fail because they cannot find imported modules - Module resolution issues in Nix builds
  • #4853: When built from the flake, opencode package is extremely large (4GB+) - Nix flake configuration issues
  • #6750: Intermittent empty output from Bash/Tool execution - Similar empty output problem
  • #7207: opencode shell output empty - Related shell command output issues
  • #7540: Does not build on Arch Linux - Related build environment failures
  • #8188: [build from src] 'bun install' Failed in Docker - Similar environment-specific build issues
  • #9273: Binary name collision blocks Nix packaging - Related Nix packaging blocker

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Jan 18 '26 21:01 github-actions[bot]