{"record":{"id":"9208218e212f079e","repo":"tinyhumansai/openhuman","slug":"flow-id-not-found-after-update","errorCode":null,"errorMessage":"flow '{id}' not found after update","messagePattern":"flow '(.+?)' not found after update","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/flows/store.rs","lineNumber":469,"sourceCode":"    tracing::debug!(flow_id = %id, \"[flows] removed flow definition\");\n    Ok(())\n}\n\n/// Toggles a flow's `enabled` flag, returning the updated record.\npub fn set_enabled(config: &Config, id: &str, enabled: bool) -> Result<Flow> {\n    let now = Utc::now().to_rfc3339();\n    let changed = with_connection(config, |conn| {\n        conn.execute(\n            \"UPDATE flow_definitions SET enabled = ?1, updated_at = ?2 WHERE id = ?3\",\n            params![if enabled { 1 } else { 0 }, now, id],\n        )\n        .context(\"Failed to update flow enabled state\")\n    })?;\n    if changed == 0 {\n        anyhow::bail!(\"flow '{id}' not found\");\n    }\n    tracing::debug!(flow_id = %id, enabled, \"[flows] set_enabled\");\n    get_flow(config, id)?.ok_or_else(|| anyhow::anyhow!(\"flow '{id}' not found after update\"))\n}\n\n/// How many revision snapshots to retain per flow (audit F6). Older ones are\n/// pruned on each new capture.\nconst MAX_REVISIONS_PER_FLOW: usize = 20;\n\n/// Failure modes of [`update_flow_graph`] that the caller must distinguish:\n/// a genuine not-found, an optimistic-concurrency conflict (carrying the\n/// current server flow so the UI can diff/reload), or a store error.\n#[derive(Debug)]\npub enum FlowUpdateError {\n    /// No flow with that id exists.\n    NotFound,\n    /// The flow changed since `expected_updated_at` was observed — the write\n    /// was refused to avoid clobbering. Carries the current server flow.\n    Conflict(Box<Flow>),\n    /// An underlying store failure.\n    Store(anyhow::Error),","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/flows/store.rs#L451-L487","documentation":"set_enabled updated a flow's enabled flag but the follow-up fetch of the updated record found no row for the id: the UPDATE reported zero changed rows (or a concurrent delete removed it between write and read). Indicates the flow id does not exist in flow_definitions, not a SQL failure.","triggerScenarios":"Thrown at src/openhuman/flows/store.rs:469 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the flow id exists (list flows first)","Handle concurrent deletion by re-checking before toggling"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}