{"record":{"id":"a9558591484bce5f","repo":"uutils/coreutils","slug":"valuevalidation","errorCode":"ValueValidation","errorMessage":"invalid operand: empty string","messagePattern":"invalid operand: empty string","errorType":"validation","errorClass":"clap::Error","httpStatus":null,"severity":"error","filePath":"src/uu/realpath/src/realpath.rs","lineNumber":54,"sourceCode":"const OPT_RELATIVE_BASE: &str = \"relative-base\";\n\nconst ARG_FILES: &str = \"files\";\n\n/// Custom parser that validates `OsString` is not empty\n#[derive(Clone, Debug)]\nstruct NonEmptyOsStringParser;\n\nimpl TypedValueParser for NonEmptyOsStringParser {\n    type Value = OsString;\n\n    fn parse_ref(\n        &self,\n        _cmd: &Command,\n        _arg: Option<&Arg>,\n        value: &OsStr,\n    ) -> Result<Self::Value, clap::Error> {\n        if value.is_empty() {\n            let mut err = clap::Error::new(clap::error::ErrorKind::ValueValidation);\n            err.insert(\n                clap::error::ContextKind::Custom,\n                clap::error::ContextValue::String(translate!(\"realpath-invalid-empty-operand\")),\n            );\n            return Err(err);\n        }\n        Ok(value.to_os_string())\n    }\n}\n\nimpl ValueParserFactory for NonEmptyOsStringParser {\n    type Parser = Self;\n\n    fn value_parser() -> Self::Parser {\n        Self\n    }\n}\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/uutils/coreutils/blob/85295bbf788bfd7a6926ba692031563504b304b7/src/uu/realpath/src/realpath.rs#L36-L72","documentation":"Error \"invalid operand: empty string\" thrown in uutils/coreutils.","triggerScenarios":"Occurs when realpath is given an empty string as an operand.","commonSituations":"Calling `realpath \"\"` or passing an unset/empty shell variable as the path argument.","solutions":["Pass a non-empty path operand to realpath.","Quote or escape arguments so an empty string is not produced by shell expansion."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"85295bbf788bfd7a6926ba692031563504b304b7","analyzedAt":"2026-08-19T21:43:27.871Z","contentChangedAt":"2026-08-19T21:43:27.871Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}