[PR #9283] fix(nix): make shell completion installation resilient to failures #13051

Closed
opened 2026-02-16 18:17:55 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9283

State: closed
Merged: No


Fixes #9285

Summary

Fixes Nix build failure when shell completion generation fails or produces empty output.

Changes

  • Capture completion output before installation
  • Add error handling with || true to prevent build failures if bash or zsh are not installed
  • Only install completions if they contain content (using -n test)
  • Use safe piping with echo instead of direct command substitution
  • Add warning messages (following nixpkgs convention with ANSI color codes) when completion generation fails

Problem

The build was failing with:

ERROR: installShellCompletion: installed shell completion file does not exist or has zero size

This occurred when:

  • opencode completion command failed or returned empty output during the Nix build process
  • bash or zsh shells were not installed in the build environment

Solution

The completion installation is now optional and gracefully handles failures, allowing the build to succeed even if completions cannot be generated. Warning messages are displayed when completion generation fails.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9283 **State:** closed **Merged:** No --- Fixes #9285 ## Summary Fixes Nix build failure when shell completion generation fails or produces empty output. ## Changes - Capture completion output before installation - Add error handling with `|| true` to prevent build failures if bash or zsh are not installed - Only install completions if they contain content (using `-n` test) - Use safe piping with `echo` instead of direct command substitution - Add warning messages (following nixpkgs convention with ANSI color codes) when completion generation fails ## Problem The build was failing with: ``` ERROR: installShellCompletion: installed shell completion file does not exist or has zero size ``` This occurred when: - `opencode completion` command failed or returned empty output during the Nix build process - bash or zsh shells were not installed in the build environment ## Solution The completion installation is now optional and gracefully handles failures, allowing the build to succeed even if completions cannot be generated. Warning messages are displayed when completion generation fails.
yindo added the pull-request label 2026-02-16 18:17:55 -05:00
yindo closed this issue 2026-02-16 18:17:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13051