tinyhumansai/openhuman · error

missing required string argument

Error message

missing required string argument `{key}`

What it means

Shared required-argument validator (`read_required_str`) for the artifact agent tools. A tool arg is fetched from the JSON args object, must be a string, and after trimming must be non-empty; if the key is missing, not a string, or blank (whitespace-only), this fires with the key name substituted. Generic input guard protecting all artifact tools from empty ids.

Solutions

  1. Pass the required key as a non-empty string, e.g. {"artifact_id": "<uuid>"}.
  2. Trim whitespace — a whitespace-only value is rejected.
  3. Use artifact_list first to obtain a valid artifact id.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/agent/artifacts/tools.rs:40 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/1741511856be117a. Report an issue: GitHub.

Appendix: source

Thrown at src/openhuman/agent/artifacts/tools.rs:40

use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolResult};

/// Read `offset` / `limit` as optional `usize` from tool args.
fn read_opt_usize(args: &serde_json::Value, key: &str) -> Option<usize> {
    args.get(key)
        .and_then(serde_json::Value::as_u64)
        .map(|v| v as usize)
}

/// Read a required, non-empty string arg.
fn read_required_str(args: &serde_json::Value, key: &str) -> anyhow::Result<String> {
    let raw = args
        .get(key)
        .and_then(serde_json::Value::as_str)
        .map(str::trim)
        .filter(|s| !s.is_empty());
    match raw {
        Some(s) => Ok(s.to_string()),
        None => Err(anyhow::anyhow!("missing required string argument `{key}`")),
    }
}

/// List artifacts the agent has produced, newest first.
pub struct ArtifactListTool {
    config: Arc<Config>,
}

impl ArtifactListTool {
    pub fn new(config: Arc<Config>) -> Self {
        Self { config }
    }
}

#[async_trait]
impl Tool for ArtifactListTool {
    fn name(&self) -> &str {
        "artifact_list"

View on GitHub (pinned to 7491200858)