{"record":{"id":"fbc2ebfc42503674","repo":"can1357/oh-my-pi","slug":"missing-destination-file-operand-after","errorCode":null,"errorMessage":"missing destination file operand after {}","messagePattern":"missing destination file operand after (.+?)","errorType":"error_code","errorClass":"LnError","httpStatus":null,"severity":"error","filePath":"crates/pi-builtins/src/ln.rs","lineNumber":62,"sourceCode":"#[derive(Clone, Debug, Eq, PartialEq)]\nenum OverwriteMode {\n\tNoClobber,\n\tInteractive,\n\tForce,\n}\n\n#[derive(Error, Debug)]\nenum LnError {\n\t#[error(\"target {} is not a directory\", _0.quote())]\n\tTargetIsNotADirectory(PathBuf),\n\n\t#[error(\"\")]\n\tSomeLinksFailed,\n\n\t#[error(\"{} and {} are the same file\", _0.quote(), _1.quote())]\n\tSameFile(PathBuf, PathBuf),\n\n\t#[error(\"missing destination file operand after {}\", _0.quote())]\n\tMissingDestination(PathBuf),\n\n\t#[error(\"extra operand {}\\nTry '{} --help' for more information.\", _0.quote(), _1)]\n\tExtraOperand(OsString, String),\n\n\t#[error(\"{}: hard link not allowed for directory\", _0.to_string_lossy())]\n\tFailedToCreateHardLinkDir(PathBuf),\n\n\t#[error(\"{0}\")]\n\tMessage(String),\n\n\t#[error(\"{0}\")]\n\tIo(#[from] std::io::Error),\n}\n\n\nmod options {\n\tpub const FORCE: &str = \"force\";","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-builtins/src/ln.rs#L44-L80","documentation":"The ln builtin's MissingDestination variant fires when only one operand is given and the default destination directory is unavailable. GNU ln treats a single argument as 'link into the current directory', but this build requires an explicit destination file path; without one it reports the missing operand after the quoted source.","triggerScenarios":"Invoking ln with a single argument, e.g. `ln file.txt`, in a context where the implicit destination (current directory) cannot be resolved or is not supported by the host.","commonSituations":"Ported shell scripts that rely on GNU ln's single-operand 'link into cwd' behavior; hand-typed commands omitting the target.","solutions":["Always pass an explicit destination: ln file.txt ./file.txt","Fix the calling code to supply the destination path argument","If cwd-linking is intended, resolve the destination explicitly (e.g. current_dir().join(filename))"],"exampleFix":"// before\nln(&host, &[\"file.txt\"])?;\n// after\nln(&host, &[\"file.txt\", \"./file.txt\"])?;","handlingStrategy":"validation","validationCode":"fn require_destination(args: &[&OsStr]) -> Result<(), &'static str> {\n    if args.len() < 2 { return Err(\"ln requires a destination operand\"); }\n    Ok( )\n}","typeGuard":null,"tryCatchPattern":"match ln(&host, args) {\n    Err(e) if e.to_string().starts_with(\"missing destination file operand\") => eprintln!(\"usage: ln SOURCE DEST\"),\n    other => other?,\n}","preventionTips":["Always pass both source and destination explicitly","Don't rely on GNU ln's single-operand cwd behavior in ported scripts"],"tags":["filesystem","hardlink","argument-error","missing-argument"],"backgroundTag":"missing-file-operand","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}