tinyhumansai/openhuman · error · anyhow::Error

integrationId must be a 24-char hex id

Error message

integrationId must be a 24-char hex id

What it means

fetch_integration_tokens_handoff validates the integration id's shape before any request: it must be a 24-character hexadecimal string (a Mongo-style ObjectId), otherwise the backend handoff route would be unreachable with this id.

Solutions

  1. Pass the exact 24-hex-character integrationId returned by the integrations listing
  2. Check for copied ids with truncation or extra characters
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/api/rest.rs:879 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/78d04800ae906058. Report an issue: GitHub.

Appendix: source

Thrown at src/api/rest.rs:879

        let integrations = value
            .get("integrations")
            .cloned()
            .unwrap_or_else(|| value.clone());
        serde_json::from_value(integrations).context("parse integrations response")
    }

    /// Fetches the decrypted OAuth tokens for a specific integration.
    ///
    /// This is a one-time handoff process. The encryption key must match the
    /// one used by the backend to encrypt the tokens.
    pub async fn fetch_integration_tokens_handoff(
        &self,
        integration_id: &str,
        bearer_jwt: &str,
        encryption_key: &str,
    ) -> Result<IntegrationTokensHandoff> {
        let id = integration_id.trim();
        anyhow::ensure!(
            !id.is_empty() && id.len() == 24,
            "integrationId must be a 24-char hex id"
        );
        let body = serde_json::json!({ "key": encryption_key.trim() });
        let value = self
            .authed_json(
                bearer_jwt,
                Method::POST,
                &format!("auth/integrations/{id}/tokens"),
                Some(body),
            )
            .await
            .context("integration tokens handoff")?;
        let encrypted = value
            .get("encrypted")
            .and_then(Value::as_str)
            .context("integration tokens response missing encrypted payload")?;
        let plaintext = decrypt_handoff_blob(encrypted, encryption_key.trim())?;

View on GitHub (pinned to 7491200858)