zeroclaw-labs/zeroclaw · error · anyhow::Error

chat.postMessage failed ({status}): {sanitized}

Error message

chat.postMessage failed ({status}): {sanitized}

What it means

Error "chat.postMessage failed ({status}): {sanitized}" thrown in zeroclaw-labs/zeroclaw.

Source

Thrown at crates/zeroclaw-channels/src/slack.rs:1256

        });

        let resp = self
            .http_client()
            .post(self.slack_api_url("chat.postMessage"))
            .bearer_auth(&self.bot_token)
            .json(&body)
            .send()
            .await?;

        let status = resp.status();
        let raw = resp
            .text()
            .await
            .unwrap_or_else(|e| format!("<failed to read response body: {e}>"));

        if !status.is_success() {
            let sanitized = zeroclaw_providers::sanitize_api_error(&raw);
            anyhow::bail!("chat.postMessage failed ({status}): {sanitized}");
        }

        let parsed: serde_json::Value = serde_json::from_str(&raw).unwrap_or_default();
        if parsed.get("ok") == Some(&serde_json::Value::Bool(false)) {
            let err = parsed
                .get("error")
                .and_then(|e| e.as_str())
                .unwrap_or("unknown");
            anyhow::bail!("chat.postMessage failed: {err}");
        }

        parsed
            .get("ts")
            .and_then(|v| v.as_str())
            .map(String::from)
            .ok_or_else(|| {
                ::zeroclaw_log::record!(
                    WARN,

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Check the Slack response status/body (e.g. channel_not_found, not_in_channel, rate_limited); fix channel ID or invite the bot and retry.

When it happens

Trigger: Thrown at crates/zeroclaw-channels/src/slack.rs:1256 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/b1afba43752e4b5a. Report an issue: GitHub.