{"record":{"id":"f2b25c2535b02236","repo":"rust-lang/cargo","slug":"expect-run-id-in-format-20060724t012128000z-16-c","errorCode":null,"errorMessage":"expect run ID in format `20060724T012128000Z-<16-char-hex>`, got `{s}`","messagePattern":"expect run ID in format `20060724T012128000Z-<16-char-hex>`, got `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/util/logger.rs","lineNumber":201,"sourceCode":"    }\n}\n\nimpl std::fmt::Display for RunId {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        let hash = &self.hash;\n        let timestamp = self.timestamp.strftime(Self::FORMAT);\n        write!(f, \"{timestamp}-{hash}\")\n    }\n}\n\nimpl std::str::FromStr for RunId {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        let msg =\n            || format!(\"expect run ID in format `20060724T012128000Z-<16-char-hex>`, got `{s}`\");\n        let Some((timestamp, hash)) = s.rsplit_once('-') else {\n            anyhow::bail!(msg());\n        };\n\n        if hash.len() != 16 || !hash.chars().all(|c| c.is_ascii_hexdigit()) {\n            anyhow::bail!(msg());\n        }\n        let timestamp = jiff::civil::DateTime::strptime(Self::FORMAT, timestamp)\n            .and_then(|dt| dt.to_zoned(jiff::tz::TimeZone::UTC))\n            .map(|zoned| zoned.timestamp())\n            .with_context(msg)?;\n\n        Ok(RunId {\n            timestamp,\n            hash: hash.into(),\n        })\n    }\n}\n\n#[cfg(test)]","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/rust-lang/cargo/blob/eb98b54bc9f3c74519f43d066cb3fd02ebc88df0/src/util/logger.rs#L183-L219","documentation":"RunId::from_str expects the form `<timestamp>-<16-hex>`, e.g. `20060724T012128000Z-0123456789abcdef`. The first failure point is rsplit_once('-') returning None — the input contains no '-' separator at all, so it cannot be split into timestamp and hash.","triggerScenarios":"Parsing a CARGO_LOG_RUN_ID (or equivalent) value that has no '-' separator, e.g. a bare timestamp, a bare hash, or a totally different string.","commonSituations":"Env var truncated by a shell quoting bug; a hand-typed run id; a tool writing only part of the id.","solutions":["Regenerate the run id by letting Cargo produce it (it always emits the canonical form).","Ensure the value contains exactly one '-' separating a jiff-parseable timestamp from a 16-char hex suffix."],"exampleFix":"# before\n# CARGO_LOG_RUN_ID=20060724T012128000Z\n\n# after\n# CARGO_LOG_RUN_ID=20060724T012128000Z-0123456789abcdef","handlingStrategy":"validation","validationCode":"fn run_id_has_separator(s: &str) -> Result<(), String> {\n    if s.rsplit_once('-').is_none() {\n        return Err(format!(\"run id `{s}` missing '-' separator; expected <timestamp>-<16-hex>\"));\n    }\n    Ok(())\n}","typeGuard":"fn run_id_shape_ok(s: &str) -> bool {\n    s.rsplit_once('-').is_some()\n}","tryCatchPattern":null,"preventionTips":["Never truncate CARGO_LOG_RUN_ID; copy the full id cargo emits.","Validate the id shape before exporting it in CI matrices."],"tags":["logging","parsing","configuration","validation"],"backgroundTag":null,"analyzedSha":"eb98b54bc9f3c74519f43d066cb3fd02ebc88df0","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}