{"record":{"id":"336eddf57e841766","repo":"block/buzz","slug":"timeout-failed-e","errorCode":null,"errorMessage":"timeout failed: {e}","messagePattern":"timeout failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/buzz-relay/src/handlers/report_resolution.rs","lineNumber":720,"sourceCode":"            let target = ctx\n                .target_pubkey\n                .ok_or_else(|| anyhow::anyhow!(\"timeout requires target_pubkey\"))?;\n            let until = ctx\n                .timeout_until\n                .ok_or_else(|| anyhow::anyhow!(\"timeout requires timeout_until\"))?;\n            state\n                .db\n                .execute_timeout_with_marker(\n                    action_id,\n                    lease_token,\n                    ctx.community_id,\n                    target,\n                    ctx.actor_pubkey,\n                    until,\n                    ctx.reason,\n                )\n                .await\n                .map_err(|e| anyhow::anyhow!(\"timeout failed: {e}\"))\n        }\n        \"kick\" => {\n            let target = ctx\n                .target_pubkey\n                .ok_or_else(|| anyhow::anyhow!(\"kick requires target_pubkey\"))?;\n            let ch = ctx\n                .channel_id\n                .ok_or_else(|| anyhow::anyhow!(\"kick requires channel_id\"))?;\n            match state\n                .db\n                .execute_kick_with_marker(\n                    action_id,\n                    lease_token,\n                    ctx.community_id,\n                    ch,\n                    target,\n                    ctx.actor_pubkey,\n                )","sourceCodeStart":702,"sourceCodeEnd":738,"githubUrl":"https://github.com/block/buzz/blob/eed74bde2f4797714335ac10c56c0b0244c1def4/crates/buzz-relay/src/handlers/report_resolution.rs#L702-L738","documentation":"The 'timeout' arm of `run_atomic_mutation` wraps any failure from `state.db.execute_timeout_with_marker` with 'timeout failed: {e}'. The context was complete (target and expiry present), but the database-side timeout operation failed, and the error is re-wrapped for the enforcement driver's bookkeeping.","triggerScenarios":"Calling `execute_timeout_with_marker` when the DB operation errors: lease/marker conflict from a concurrent driver, missing user/community rows, invalid timestamp comparison, constraint violation, or Postgres connectivity failure.","commonSituations":"Two drivers racing to apply the same timeout action; the timed-out user record removed before enforcement; clock/timestamp values out of range for the DB column; transient Postgres outages under load.","solutions":["Inspect the inner `{e}` message in the error chain for the concrete DB cause.","Treat lease/marker conflicts as 'already applied' — the atomic marker makes timeouts idempotent per action_id.","Check Postgres availability and schema migrations; run `just test` integration suite to reproduce locally.","Retry the driver on transient errors; skip actions whose marker shows another driver completed them."],"exampleFix":"// before\nexecute_timeout_with_marker(...).await.map_err(|e| anyhow!(\"timeout failed: {e}\"))\n// after — tolerate already-applied marker\nmatch execute_timeout_with_marker(...).await {\n  Ok(applied) => Ok(applied),\n  Err(e) if e.to_string().contains(\"marker already set\") => Ok(false),\n  Err(e) => Err(anyhow!(\"timeout failed: {e}\")),\n}","handlingStrategy":"retry","validationCode":"anyhow::ensure!(ctx.target_pubkey.is_some(), \"timeout needs target\");\nanyhow::ensure!(ctx.timeout_until.is_some(), \"timeout needs expiry\");\nanyhow::ensure!(ctx.timeout_until.unwrap() > chrono::Utc::now(), \"expiry must be future\");","typeGuard":null,"tryCatchPattern":"for attempt in 0..3 {\n  match run_atomic_mutation(&state, ctx).await {\n    Ok(applied) => break Ok(applied),\n    Err(e) if e.to_string().contains(\"timeout failed\") && attempt < 2 && is_transient(&e) => {\n      tokio::time::sleep(backoff(attempt)).await; // idempotent via action marker\n    }\n    Err(e) => break Err(e),\n  }\n}","preventionTips":["Retry only transient DB errors; the marker makes the timeout idempotent per action_id.","Log the complete error chain to expose the underlying Postgres cause.","Validate timestamp ranges fit the DB column type before writing.","Monitor Postgres connectivity from the enforcement driver."],"tags":["moderation","database","postgres","rust","backend"],"backgroundTag":"database-operation-failed","analyzedSha":"eed74bde2f4797714335ac10c56c0b0244c1def4","analyzedAt":"2026-08-30T13:49:18.474Z","contentChangedAt":"2026-08-30T13:49:18.474Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}