{"record":{"id":"78a719a026a0be26","repo":"zeroclaw-labs/zeroclaw","slug":"talk-api-error-status","errorCode":null,"errorMessage":"Talk API error: {status}","messagePattern":"Talk API error: (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-channels/src/nextcloud_talk.rs","lineNumber":549,"sourceCode":"    }\n\n    async fn send_to_room(&self, room_token: &str, content: &str) -> anyhow::Result<()> {\n        let response = self.post_to_room(room_token, content).await?;\n\n        if response.status().is_success() {\n            return Ok(());\n        }\n\n        let status = response.status();\n        let body = response.text().await.unwrap_or_default();\n        ::zeroclaw_log::record!(\n            ERROR,\n            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)\n                .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                .with_attrs(::serde_json::json!({\"status\": status.to_string(), \"body\": body})),\n            \"Talk send failed:\"\n        );\n        anyhow::bail!(\"Talk API error: {status}\");\n    }\n\n    /// Send a message and return the response from Nextcloud Talk.\n    async fn send_to_room_with_id(\n        &self,\n        room_token: &str,\n        content: &str,\n    ) -> anyhow::Result<String> {\n        let response = self.post_to_room(room_token, content).await?;\n\n        if !response.status().is_success() {\n            let status = response.status();\n            let body = response.text().await.unwrap_or_default();\n            ::zeroclaw_log::record!(\n                WARN,\n                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)\n                    .with_outcome(::zeroclaw_log::EventOutcome::Unknown)\n                    .with_attrs(::serde_json::json!({\"status\": status.to_string(), \"body\": body})),","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-channels/src/nextcloud_talk.rs#L531-L567","documentation":"`send_to_room` posts an HMAC-signed message to the Talk bot API and bails with `Talk API error: {status}` on any non-success response; the status and body are also logged at ERROR level with the module's structured logger. Common statuses: 401 bad/mismatched bot secret, 404 unknown room token, 400 rejected message.","triggerScenarios":"`Channel::send` (or `finalize_draft`) posting to a room where signing fails validation (stale secret), the bot was removed from the conversation, or the room token is wrong.","commonSituations":"Bot secret regenerated in Nextcloud after config was written; bot kicked from the conversation; room token copied from a share link instead of the API token; message over Talk's length limit after truncation rules.","solutions":["Check the structured log entry — it includes the status and the response body, which states the reason","401: re-copy the current bot secret into `bot_token`","404: verify the room token matches the conversation the bot is in","Ensure the bot is still a participant of the target room"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match talk_channel.send(msg).await {\n    Err(e) if e.to_string().starts_with(\"Talk API error: 401\") => {\n        // secret mismatch: re-copy bot secret, then retry once\n    }\n    Err(e) if e.to_string().starts_with(\"Talk API error: 404\") => {\n        // wrong room token: fix mapping, do not retry\n    }\n    other => other,\n}","preventionTips":["Match on the status in the error string to choose re-auth vs fix-room vs retry","Check the structured log for the response body — it has the server's reason","When the bot secret is rotated in Nextcloud, update config in the same change"],"tags":["nextcloud-talk","send","http-status","rust"],"backgroundTag":"http-error-response","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}