can1357/oh-my-pi · error · SortError

{} terminated abnormally

Error message

{} terminated abnormally

What it means

`SortError::CompressProgTerminatedAbnormally` is raised when the compression program started via `--compress-program` exits with a nonzero/signal status rather than completing normally. The message includes the quoted program name. The compressor itself failed on the data stream.

Source

Thrown at crates/pi-builtins/src/sort.rs:2611

	#[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,

	#[error("no input from {}", .file.quote())]
	EmptyInputFile { file: PathBuf },

View on GitHub (pinned to 9690622007)

Solutions

  1. Use a supported stream compressor such as gzip, bzip2, xz, or zstd.
  2. Test the compressor standalone: `cat sample | <prog> | <prog> -d > /dev/null`.
  3. Check the compressor's own stderr/version for incompatibilities; upgrade or replace it.
  4. Drop --compress-program to sort without compression and isolate whether the compressor is at fault.

Example fix

// before
sort --compress-program=mycustomcomp big.txt

// after
sort --compress-program=zstd big.txt
Defensive patterns

Strategy: try-catch

Validate before calling

// smoke-test the compressor round-trip before relying on it
let ok = std::process::Command::new("sh")
    .arg("-c")
    .arg("echo x | gzip | gzip -d > /dev/null")
    .status()
    .map(|s| s.success())
    .unwrap_or(false);
if !ok { eprintln!("compress program failed round-trip test"); }

Try / catch

match sort_result {
    Err(SortError::CompressProgTerminatedAbnormally { prog }) => {
        eprintln!("'{prog}' terminated abnormally; switch to gzip/zstd or drop --compress-program");
    }
    Err(e) => eprintln!("sort: {e}"),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: The compress program launches successfully but crashes or exits nonzero while compressing or decompressing a chunk during an external-merge sort.

Common situations: A program that is not a filter-style compressor (e.g. exits on its own without reading stdin); corrupt/incompatible compressor versions; a wrapper script failing on some inputs.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/9512d6a8c7c43a6a. Report an issue: GitHub.