{"record":{"id":"8f39a7efe89f8bb4","repo":"zeroclaw-labs/zeroclaw","slug":"cli-alias-live-acp-sessions","errorCode":"cli-alias-live-acp-sessions","errorMessage":"{$count} live ACP session(s) for `{$alias}` — end them first","messagePattern":"(.+?) live ACP session\\(s\\) for `(.+?)` — end them first","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/alias_cli/mod.rs","lineNumber":461,"sourceCode":"                &config.channels.session_backend,\n            )\n            .context(\"open session backend for the owned-state cascade\")?,\n        )\n    } else {\n        None\n    };\n    Ok((mem, session_backend))\n}\n\n#[cfg(all(feature = \"gateway\", feature = \"agent-runtime\"))]\nfn agent_delete_precheck(config: &Config, alias: &str) -> Result<()> {\n    // Fail closed: refuse if live ACP sessions exist, or if the store can't be\n    // read to verify (mirrors the gateway delete gate).\n    let live = crate::gateway::agent_owned_state::live_acp_session_count(config, alias)\n        .context(\"could not verify live ACP sessions\")?;\n    if live > 0 {\n        let count = live.to_string();\n        bail!(\n            \"{}\",\n            mta(\n                \"cli-alias-live-acp-sessions\",\n                &[(\"count\", count.as_str()), (\"alias\", alias)],\n                \"{$count} live ACP session(s) for `{$alias}` — end them first\"\n            )\n        );\n    }\n    Ok(())\n}\n\n#[cfg(not(all(feature = \"gateway\", feature = \"agent-runtime\")))]\nfn agent_delete_precheck(_config: &Config, _alias: &str) -> Result<()> {\n    Ok(())\n}\n\n#[cfg(all(feature = \"gateway\", feature = \"agent-runtime\"))]\nasync fn agent_delete_owned_state(","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/src/alias_cli/mod.rs#L443-L479","documentation":"Fail-closed precheck in agent_delete_precheck: live ACP sessions exist for the alias (or the session store could not be read to prove otherwise), so the agent delete is refused to avoid orphaning running sessions. Mirrors the gateway's own delete gate.","triggerScenarios":"Thrown at src/alias_cli/mod.rs:461 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["End the live ACP sessions for the alias first, then retry the operation.","Restart the gateway or disconnect the listed ACP clients to clear the sessions."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","contentChangedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}