{"record":{"id":"1fbb0dd47670dfea","repo":"tinyhumansai/openhuman","slug":"missing-required-string-argument-code","errorCode":null,"errorMessage":"missing required string argument `code`","messagePattern":"missing required string argument `code`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/hosted/referral/tools.rs","lineNumber":102,"sourceCode":"                \"code\": { \"type\": \"string\" },\n                \"device_fingerprint\": { \"type\": \"string\" }\n            },\n            \"required\": [\"code\"]\n        })\n    }\n\n    fn permission_level(&self) -> PermissionLevel {\n        PermissionLevel::Write\n    }\n\n    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {\n        log::debug!(\"[tool][referral] claim invoked\");\n        let code = args\n            .get(\"code\")\n            .and_then(Value::as_str)\n            .map(str::trim)\n            .filter(|s| !s.is_empty())\n            .ok_or_else(|| anyhow::anyhow!(\"missing required string argument `code`\"))?;\n        let fp = args.get(\"device_fingerprint\").and_then(Value::as_str);\n        emit!(\n            referral::claim_referral(&self.config, code, fp).await,\n            \"referral_claim\"\n        )\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::openhuman::tools::traits::ToolScope;\n\n    fn cfg() -> Arc<Config> {\n        Arc::new(Config::default())\n    }\n\n    #[test]","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/hosted/referral/tools.rs#L84-L120","documentation":"The referral claim tool was invoked without a usable `code` argument — absent, not a string, or blank after trim (the filter also rejects empty). Guard on tool arguments before the bounded claim call to the backend.","triggerScenarios":"Thrown at src/openhuman/hosted/referral/tools.rs:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the referral code as a non-empty `code` string"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}