tinyhumansai/openhuman · error · anyhow::Error

channel is required

Error message

channel is required

What it means

create_channel_link_token trims the channel identifier (including surrounding slashes) and found it empty, so the backend route cannot be addressed and the call is rejected before any request is sent.

Solutions

  1. Pass the channel name, e.g. 'telegram' or 'discord'
  2. Check that the channel argument was not omitted or reduced to slashes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/api/rest.rs:555 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/779bb276bb6d3cdd. Report an issue: GitHub.

Appendix: source

Thrown at src/api/rest.rs:555

            .to_string();
        anyhow::ensure!(!jwt.is_empty(), "consume login token response missing jwt");
        Ok(jwt)
    }

    /// Validates that the provided session token is still active and accepted.
    pub async fn validate_session_token(&self, bearer_jwt: &str) -> Result<()> {
        let _ = self.fetch_current_user(bearer_jwt).await?;
        Ok(())
    }

    /// Creates a short-lived link token for connecting a specific communication channel.
    pub async fn create_channel_link_token(
        &self,
        channel: &str,
        bearer_jwt: &str,
    ) -> Result<Value> {
        let channel = channel.trim().trim_matches('/');
        anyhow::ensure!(!channel.is_empty(), "channel is required");
        let encoded_channel = urlencoding::encode(channel);

        self.authed_json(
            bearer_jwt,
            Method::POST,
            &format!("auth/channels/{encoded_channel}/link-token"),
            None,
        )
        .await
    }

    /// Generic authenticated JSON request helper for backend API routes.
    pub async fn authed_json(
        &self,
        bearer_jwt: &str,
        method: Method,
        path: &str,
        body: Option<Value>,

View on GitHub (pinned to 7491200858)