{"record":{"id":"3aa69eb04ae1b945","repo":"Morganamilo/paru","slug":"key-can-not-contain-null-bytes","errorCode":null,"errorMessage":"key can not contain null bytes","messagePattern":"key can not contain null bytes","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/config.rs","lineNumber":991,"sourceCode":"        let repo = self.pkgbuild_repos.repo_mut(repo).unwrap();\n\n        match key {\n            \"Url\" => repo.source.set_url(Url::parse(value?)?),\n            \"Path\" => repo.source.set_path(value?.to_string()),\n            \"Depth\" => repo.depth = value?.parse()?,\n            \"SkipReview\" => repo.skip_review = true,\n            \"GenerateSrcinfo\" => repo.force_srcinfo = true,\n            _ => eprintln!(\"{}\", tr!(\"error: unknown option '{}' in repo\", key)),\n        }\n\n        Ok(())\n    }\n\n    fn parse_env(&mut self, key: &str, value: Option<&str>) -> Result<()> {\n        let value = value.context(tr!(\"key can not be empty\"))?;\n\n        ensure!(!key.is_empty(), tr!(\"key can not be empty\"));\n        ensure!(!key.contains('\\0'), tr!(\"key can not contain null bytes\"));\n        ensure!(\n            !value.contains('\\0'),\n            tr!(\"value can not contain null bytes\")\n        );\n\n        self.env.push((key.to_owned(), value.to_string()));\n        set_var(key, value);\n        Ok(())\n    }\n\n    fn parse_bin(&mut self, key: &str, value: Option<&str>) -> Result<()> {\n        let value = value\n            .map(|s| s.to_string())\n            .ok_or_else(|| anyhow!(tr!(\"key can not be empty\")))?;\n\n        let split = value.split_whitespace().map(|s| s.to_string());\n\n        match key {","sourceCodeStart":973,"sourceCodeEnd":1009,"githubUrl":"https://github.com/Morganamilo/paru/blob/9ac3578807a87858651e81a02586ceb947686e7c/src/config.rs#L973-L1009","documentation":"parse_env rejects environment variable keys containing NUL ('\\0') bytes. NUL bytes are invalid in environment variable names on Unix (execve-style env blocks are NUL-delimited), so any key containing one would be truncated or rejected by the OS. The library raises this to fail early with a clear message.","triggerScenarios":"A key string parsed from the config [env] section contains a '\\0' character, e.g. from a binary-corrupted config file or bad escaping.","commonSituations":"Corrupted or machine-generated paru.conf with embedded null bytes; files edited through tools that inserted NULs.","solutions":["Locate the offending [env] entry (e.g. grep -P '\\x00' paru.conf) and remove the null byte","Recreate the config file from a clean copy instead of editing the binary-corrupted file","Validate the config is UTF-8 text: file/iconv check"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn valid_env_key(key: &str) -> bool {\n    !key.is_empty() && !key.contains('\\0')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep config files as clean UTF-8 text","Never write config files with binary tools","Check for NUL bytes with grep -P '\\x00' after programmatic edits"],"tags":["config","env","validation","encoding"],"backgroundTag":"invalid-argument-format","analyzedSha":"9ac3578807a87858651e81a02586ceb947686e7c","analyzedAt":"2026-09-12T04:57:59.861Z","contentChangedAt":"2026-09-12T04:57:59.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}