{"record":{"id":"14e10467a2e35f83","repo":"databendlabs/databend","slug":"semaphore-permit-key-should-have-at-least-3-segmen","errorCode":null,"errorMessage":"semaphore permit key should have at least 3 segments: {}","messagePattern":"semaphore permit key should have at least 3 segments: (.+?)","errorType":"validation","errorClass":"InvalidInput","httpStatus":null,"severity":"error","filePath":"src/meta/plugins/semaphore/src/storage/permit_key.rs","lineNumber":62,"sourceCode":"    pub fn new(prefix: impl ToString, seq: PermitSeq) -> Self {\n        Self {\n            prefix: prefix.to_string(),\n            seq,\n        }\n    }\n\n    /// Format the key to a string, keep order preserving.\n    pub fn format_key(&self) -> String {\n        format!(\"{}/queue/{:020}\", self.prefix, self.seq)\n    }\n\n    /// Parse the key from an encoded string.\n    pub fn parse_key(key: &str) -> Result<Self, io::Error> {\n        // split by the last 2 slashes:\n        let parts = key.rsplitn(3, '/').collect::<Vec<_>>();\n\n        if parts.len() != 3 {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidInput,\n                format!(\n                    \"semaphore permit key should have at least 3 segments: {}\",\n                    key\n                ),\n            ));\n        }\n\n        if parts[1] != \"queue\" {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidInput,\n                format!(\n                    \"semaphore permit key should have 'queue' as the second segment: {}\",\n                    key\n                ),\n            ));\n        }\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/meta/plugins/semaphore/src/storage/permit_key.rs#L44-L80","documentation":"A generic input-validation guard in PermitKey::parse_key: after splitting the encoded key string with rsplitn(3, '/'), it must yield exactly three segments (seq, \"queue\", prefix). This error fires when the key string is malformed — missing slashes or fewer than three parts — typically because the stored key was corrupted or produced by an incompatible format.","triggerScenarios":"Thrown at src/meta/plugins/semaphore/src/storage/permit_key.rs:62 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the key string passed to parse_key was produced by format_key and contains at least three '/'-separated segments.","If the key comes from persistent storage, check for corruption or truncation and re-derive or regenerate the permit key.","Before calling parse_key, validate that key.matches('/').count() >= 2 and handle invalid input explicitly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}