can1357/oh-my-pi · error · SortError

{0}

Error message

{0}

What it means

`SortError::Message(String)` is a generic catch-all error in the sort builtin's error enum, rendered verbatim via `{0}`. It carries an arbitrary pre-formatted message produced by internal sort routines. Inspect the embedded string — it is the entire diagnostic.

Source

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

		Some(b'.') => b'.',
		Some(b',') => b',',
		_ => DECIMAL_PT,
	}
}

const NEGATIVE: &u8 = &b'-';
const POSITIVE: &u8 = &b'+';

// The automatic buffer heuristics clamp to this range to avoid
// over-committing memory on constrained systems while still keeping
// reasonably large chunks for typical workloads.
const MIN_AUTOMATIC_BUF_SIZE: usize = 512 * 1024; // 512 KiB
const FALLBACK_AUTOMATIC_BUF_SIZE: usize = 32 * 1024 * 1024; // 32 MiB
const MAX_AUTOMATIC_BUF_SIZE: usize = 1024 * 1024 * 1024; // 1 GiB

#[derive(Debug, Error)]
pub enum SortError {
	#[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))]

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the embedded message text; it is the complete diagnostic.
  2. Match the message content against dedicated SortError variants to see if a more specific fix applies.
  3. If the message points to a flag or input problem, correct that argument or input and rerun.
Defensive patterns

Strategy: try-catch

Try / catch

match sort_result {
    Err(SortError::Message(msg)) => {
        logger.error("sort failed with message", &msg);
        // inspect msg and apply the specific remedy it describes
    }
    Err(e) => eprintln!("sort: {e}"),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: Any internal sort code path that reports a failure not covered by a dedicated variant (WriteFailed, Disorder, OpenFailed, etc.), constructed by wrapping a plain String into SortError.

Common situations: Miscellaneous sort runtime failures surfaced during large-file or compress-program-assisted sorting where no specific variant applies.

Related errors


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