zeroclaw-labs/zeroclaw · warning · anyhow::Error
delete message failed ({status}): {err}
Error message
delete message failed ({status}): {err} What it means
delete_discord_message DELETEs a message and bails on non-success status. It is used by draft finalize/cancel to remove the provisional message once the flow completes. Deletion is naturally idempotent, so 404 (already gone) is the most common and most benign trigger.
Source
Thrown at crates/zeroclaw-channels/src/discord/rest.rs:256
.send()
.await?;
if resp.status().as_u16() == 429 {
::zeroclaw_log::record!(
DEBUG,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),
"delete message rate-limited (429), skipping"
);
return Ok(());
}
if !resp.status().is_success() {
let status = resp.status();
let err = resp
.text()
.await
.unwrap_or_else(|e| format!("<failed to read response body: {e}>"));
anyhow::bail!("delete message failed ({status}): {err}");
}
Ok(())
}
pub(crate) fn encode_emoji_for_discord(emoji: &str) -> String {
if emoji.contains(':') {
return emoji.to_string();
}
let mut encoded = String::new();
for byte in emoji.as_bytes() {
let _ = write!(encoded, "%{byte:02X}");
}
encoded
}
pub(crate) fn discord_reaction_url(channel_id: &str, message_id: &str, emoji: &str) -> String {View on GitHub (pinned to 88bb9c8533)
Solutions
- 404 → nothing to do; the desired end state already holds — treat as success
- 403 → grant Manage Messages on the channel (only needed for messages the bot did not send)
- 429 → retry with Retry-After backoff
Defensive patterns
Strategy: fallback
Try / catch
match delete_discord_message(&client, &url).await {
Ok(()) => Ok(()),
Err(e) if e.to_string().contains("404") => Ok(()), // already gone: idempotent success
Err(e) => Err(e),
} Prevention
- Deletion is idempotent — always treat 404 as success
- Grant Manage Messages only if the bot must delete messages it did not send
When it happens
Trigger: DELETE /channels/{id}/messages/{id} returns 404 (message already deleted by a user or another flow), 403 (missing Manage Messages when deleting others' messages), 429.
Common situations: User manually deletes the draft message before the agent finishes; bot lacks Manage Messages; rate-limited cleanup during bursts.
Related errors
- Discord gate-prompt finalize failed ({status})
- Discord send message failed ({status}): {err}
- Discord send message with files failed ({status}): {err}
- listing commands failed ({})
- channel does not support room creation
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/461861d02edd2690.
Report an issue: GitHub.