can1357/oh-my-pi · error · LnError

{0}

Error message

{0}

What it means

The ln builtin's Message(String) variant is a catch-all error carrying a pre-formatted message. It surfaces whenever link-creation logic produces an ad-hoc failure string that doesn't map to a specific structured variant, so the displayed error is exactly the wrapped text.

Source

Thrown at crates/pi-builtins/src/ln.rs:71

	#[error("target {} is not a directory", _0.quote())]
	TargetIsNotADirectory(PathBuf),

	#[error("")]
	SomeLinksFailed,

	#[error("{} and {} are the same file", _0.quote(), _1.quote())]
	SameFile(PathBuf, PathBuf),

	#[error("missing destination file operand after {}", _0.quote())]
	MissingDestination(PathBuf),

	#[error("extra operand {}\nTry '{} --help' for more information.", _0.quote(), _1)]
	ExtraOperand(OsString, String),

	#[error("{}: hard link not allowed for directory", _0.to_string_lossy())]
	FailedToCreateHardLinkDir(PathBuf),

	#[error("{0}")]
	Message(String),

	#[error("{0}")]
	Io(#[from] std::io::Error),
}


mod options {
	pub const FORCE: &str = "force";
	//pub const DIRECTORY: &str = "directory";
	pub const INTERACTIVE: &str = "interactive";
	pub const NO_DEREFERENCE: &str = "no-dereference";
	pub const SYMBOLIC: &str = "symbolic";
	pub const LOGICAL: &str = "logical";
	pub const PHYSICAL: &str = "physical";
	pub const TARGET_DIRECTORY: &str = "target-directory";
	pub const NO_TARGET_DIRECTORY: &str = "no-target-directory";
	pub const RELATIVE: &str = "relative";

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the wrapped message text — it is the actionable description
  2. Check the ln flags passed for invalid combinations
  3. If the message is opaque, reproduce with simpler arguments to isolate the failing operand
Defensive patterns

Strategy: try-catch

Try / catch

match ln(&host, args) {
    Err(e) => {
        let msg = e.to_string(); // Message(String) renders as {0}
        eprintln!("ln failed: {msg}");
        // surface or map msg to a caller-specific error
    }
    ok => ok?,
}

Prevention

When it happens

Trigger: Any internal ln failure path that constructs LsError/LinkError::Message with context-specific text (e.g. malformed option combinations or host-reported failures not covered by other variants).

Common situations: Unusual option usage (e.g. conflicting flags); embedders passing exotic arguments through the builtin API.

Related errors


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