can1357/oh-my-pi · error · SortError
could not run compress program '{}': {}
Error message
could not run compress program '{}': {} What it means
`SortError::CompressProgExecutionFailed` is raised when the sort builtin cannot spawn the user-specified compression program (via `--compress-program`), quoting the program name and the stripped errno. The executable was not found or could not be executed.
Source
Thrown at crates/pi-builtins/src/sort.rs:2608
#[error("{0}")]
Message(String),
#[error("write failed: {}: {}", .path.maybe_quote(), strip_errno(.error))]
WriteFailed { path: OsString, error: std::io::Error },
#[error("{}", format_disorder(.file, .line_number, .line, .silent))]
Disorder { file: OsString, line_number: usize, line: String, silent: bool },
#[error("open failed: {}: {}", .path.maybe_quote(), strip_errno(.error))]
OpenFailed { path: PathBuf, error: std::io::Error },
#[error("cannot read: {}: {}", .path.maybe_quote(), strip_errno(.error))]
ReadFailed { path: PathBuf, error: std::io::Error },
#[error("failed to open temporary file: {}", strip_errno(.error))]
OpenTmpFileFailed { error: std::io::Error },
#[error("could not run compress program '{}': {}", .prog, strip_errno(.error))]
CompressProgExecutionFailed { prog: String, error: std::io::Error },
#[error("{} terminated abnormally", .prog.quote())]
CompressProgTerminatedAbnormally { prog: String },
#[error("cannot create temporary file in {}:", .path.quote())]
TmpFileCreationFailed { path: PathBuf },
#[error("extra operand {}\nfile operands cannot be combined with --files0-from\nTry 'sort --help' for more information.", .file.quote())]
FileOperandsCombined { file: PathBuf },
#[error("multiple output files specified")]
MultipleOutputFiles,
#[error("when reading file names from standard input, no file name of '-' allowed")]
MinusInStdIn,
View on GitHub (pinned to 9690622007)
Solutions
- Verify the program is installed and on PATH (`command -v <prog>`).
- Use the fully-qualified binary path in --compress-program.
- Install the compressor in the environment (e.g. `apt-get install gzip`).
- Confirm the binary has the executable bit (`chmod +x`).
Example fix
// before sort --compress-program=gz big.txt // after sort --compress-program=/usr/bin/gzip big.txt
Defensive patterns
Strategy: validation
Validate before calling
let prog = "gzip";
let found = std::env::var_os("PATH")
.map(|paths| std::env::split_paths(&paths)
.any(|dir| dir.join(prog).is_file()))
.unwrap_or(false);
if !found { eprintln!("compress program '{prog}' not found on PATH"); } Try / catch
match sort_result {
Err(SortError::CompressProgExecutionFailed { prog, error }) => {
eprintln!("cannot run '{prog}': {error}; install it or use an absolute path");
}
Err(e) => eprintln!("sort: {e}"),
Ok(_) => {}
} Prevention
- Verify the compressor exists with `command -v` before passing --compress-program.
- Use absolute binary paths to be immune to PATH differences (cron, CI, containers).
- Install a standard compressor (gzip/zstd) in deployment images.
When it happens
Trigger: Running a memory-bounded sort with `--compress-program <prog>` where the program name is misspelled, not on PATH, or lacks the execute bit.
Common situations: Typo'd program name (`gzip` vs `gz`); minimal containers without gzip installed; PATH differences under cron/CI.
Related errors
- {} terminated abnormally
- extra operand {} file operands cannot be combined with --fil
- multiple output files specified
- when reading file names from standard input, no file name of
- --list-details, --exec, and --exec-batch are not supported b
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/bdd12e042c04264c.
Report an issue: GitHub.