tinyhumansai/openhuman · error

'{field}' must be a string or null

Error message

'{field}' must be a string or null

What it means

parse_optional_string_update maps the field's presence to MaybeSet: absent=Unset, null=Null, string=Set. This fires when the value is neither null nor a string (e.g. a number or object passed for proxy_url), rejecting the ambiguous shape before any config write.

Source

Thrown at src/openhuman/tools/impl/system/proxy_config.rs:102

            }
            return Ok(out);
        }

        anyhow::bail!("'{field}' must be a string or string[]")
    }

    fn parse_optional_string_update(args: &Value, field: &str) -> anyhow::Result<MaybeSet<String>> {
        let Some(raw) = args.get(field) else {
            return Ok(MaybeSet::Unset);
        };

        if raw.is_null() {
            return Ok(MaybeSet::Null);
        }

        let value = raw
            .as_str()
            .ok_or_else(|| anyhow::anyhow!("'{field}' must be a string or null"))?
            .trim()
            .to_string();

        let output = if value.is_empty() {
            MaybeSet::Null
        } else {
            MaybeSet::Set(value)
        };
        Ok(output)
    }

    fn env_snapshot() -> Value {
        json!({
            "HTTP_PROXY": std::env::var("HTTP_PROXY").ok(),
            "HTTPS_PROXY": std::env::var("HTTPS_PROXY").ok(),
            "ALL_PROXY": std::env::var("ALL_PROXY").ok(),
            "NO_PROXY": std::env::var("NO_PROXY").ok(),
        })

View on GitHub (pinned to 7491200858)

Solutions

  1. Pass a plain string for the field, or JSON null to explicitly clear it
  2. Omit the field entirely to leave it unchanged
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/system/proxy_config.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/38f513c397cdd7e4. Report an issue: GitHub.