Hmbown/CodeWhale · error
Agent Mail message id
Error message
Agent Mail message id '{}' already exists with different delivery intent What it means
Idempotency conflict in Agent Mail: a message with the same id already exists but with different delivery intent; the store refuses to silently overwrite the earlier intent because the id is the idempotency key.
Solutions
- Reuse the same delivery intent (recipient/status) as the original send, making the replay an exact idempotent duplicate.
- Use a new message id if the intent genuinely differs.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/runtime_threads.rs:6393 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/95af555f3456da29.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/runtime_threads.rs:6393
{
bail!(
"Agent Mail ownership denied: source and destination must belong to the same runtime owner and workspace"
);
}
let expected_sender = agent_mail_sender_identity(&source_thread)?;
if request.sender.identity != expected_sender {
bail!(
"Agent Mail ownership denied: sender identity does not own the source task/session"
);
}
let (envelope, idempotent_replay) = {
let _mail_mutation = self.store.mail_mutation.lock();
let path = self.store.mail_path(&request.message_id)?;
if path.exists() {
let persisted = self.store.load_agent_mail(&request.message_id)?;
if !persisted.matches_send_request(&request) {
bail!(
"Agent Mail message id '{}' already exists with different delivery intent",
request.message_id
);
}
(persisted, true)
} else {
let envelope = AgentMailEnvelope {
schema_version: AGENT_MAIL_SCHEMA_VERSION,
message_id: request.message_id,
source,
destination,
sender: request.sender,
summary: request.summary,
evidence: request.evidence,
delivery_mode: request.delivery_mode,
trigger_turn: request.trigger_turn,
hop_count: request.hop_count,
status: AgentMailStatus::Queued,View on GitHub (pinned to 73e0f67d83)