tinyhumansai/openhuman · error · anyhow::Error
missing required string argument `code`
Error message
missing required string argument `code`
What it means
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.
Source
Thrown at src/openhuman/hosted/referral/tools.rs:102
"code": { "type": "string" },
"device_fingerprint": { "type": "string" }
},
"required": ["code"]
})
}
fn permission_level(&self) -> PermissionLevel {
PermissionLevel::Write
}
async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
log::debug!("[tool][referral] claim invoked");
let code = args
.get("code")
.and_then(Value::as_str)
.map(str::trim)
.filter(|s| !s.is_empty())
.ok_or_else(|| anyhow::anyhow!("missing required string argument `code`"))?;
let fp = args.get("device_fingerprint").and_then(Value::as_str);
emit!(
referral::claim_referral(&self.config, code, fp).await,
"referral_claim"
)
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::openhuman::tools::traits::ToolScope;
fn cfg() -> Arc<Config> {
Arc::new(Config::default())
}
#[test]View on GitHub (pinned to 7491200858)
Solutions
- Pass the referral code as a non-empty `code` string
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/openhuman/hosted/referral/tools.rs:102 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/1fbb0dd47670dfea.
Report an issue: GitHub.