can1357/oh-my-pi · error · SortError
extra operand {} file operands cannot be combined with --fil
Error message
extra operand {}
file operands cannot be combined with --files0-from
Try 'sort --help' for more information. What it means
SortError::FileOperandsCombined is thrown when the user passes regular file operands together with --files0-from. GNU sort semantics forbid mixing: --files0-from supplies the input file list via a NUL-separated file, so no additional file operands may appear on the command line. The offending operand is included quoted.
Source
Thrown at crates/pi-builtins/src/sort.rs:2617
#[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 },
#[error("{}:{}: invalid zero-length file name", .file.maybe_quote(), .line_num)]
ZeroLengthFileName { file: PathBuf, line_num: usize },
}
impl SortError {
fn message(message: impl Into<String>) -> Self {View on GitHub (pinned to 9690622007)
Solutions
- Remove all positional file operands when using --files0-from.
- Put every input file name into the NUL-separated list consumed by --files0-from.
- Use `-` inside the list if reading names from stdin (`--files0-from=-`).
- If you only have a few inputs, drop --files0-from and pass them as plain operands instead.
Example fix
// before sort --files0-from=list.txt extra.txt // after sort --files0-from=list.txt
Defensive patterns
Strategy: validation
Validate before calling
// reject positional operands when --files0-from is set, before invoking sort
if (args.includes("--files0-from") && positionalFiles.length > 0) {
throw new Error("file operands cannot be combined with --files0-from");
} Try / catch
try {
await sort(args, files);
} catch (err) {
if (String(err).includes("files0-from")) {
// rebuild argv: move all files into the NUL-separated list
await sort(["--files0-from=", toNulList(files)], []);
} else throw err;
} Prevention
- Treat --files0-from as mutually exclusive with positional file args in any wrapper.
- Generate NUL-separated input lists with find -print0 or printf '%s\0'.
- Add an argv lint in scripts that construct sort invocations dynamically.
- Read sort --help before combining list-input flags with operands.
When it happens
Trigger: Calling the sort builtin with --files0-from=LIST and at least one positional file argument, e.g. `sort --files0-from=list.txt extra.txt`.
Common situations: Script migration where extra filenames were left over from a previous invocation; wrapping code that always appends a default input file; misunderstanding that --files0-from replaces rather than supplements operands.
Related errors
- multiple output files specified
- when reading file names from standard input, no file name of
- Invalid quoting style: {style}
- validate requires a finding URI or <scan-id> <finding-id>
- show requires a scan id or security:// URI
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/54cff4b82f7aa024.
Report an issue: GitHub.