{"record":{"id":"cead579e73019dae","repo":"t8y2/dbx","slug":"agent-session-already-exists-id","errorCode":null,"errorMessage":"agent session already exists: {id}","messagePattern":"agent session already exists: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/tdengine/src/runtime.rs","lineNumber":232,"sourceCode":"                    bail!(\"unknown method: {method}\");\n                }\n                let id = session_id(&params).unwrap_or_else(|| LEGACY_SESSION_ID.to_string());\n                let session = self.session(&id).await?;\n                let mut driver = session.driver.lock().await;\n                let (token, _operation) = session.begin_operation();\n                dispatch_driver(&mut driver, method, &params, &token).await\n            }\n        }\n    }\n\n    async fn open_session(&self, id: &str, params: ConnectParams) -> Result<()> {\n        if id.trim().is_empty() {\n            bail!(\"agentSessionId is required\");\n        }\n        {\n            let sessions = self.sessions.read().await;\n            if sessions.contains_key(id) {\n                bail!(\"agent session already exists: {id}\");\n            }\n        }\n        let slot = self\n            .session_slots\n            .clone()\n            .try_acquire_owned()\n            .map_err(|_| anyhow!(\"agent session limit reached: {MAX_AGENT_SESSIONS}\"))?;\n        let mut driver = TdengineDriver::new();\n        driver.connect(params).await?;\n        let session = Arc::new(AgentSession {\n            driver: Mutex::new(driver),\n            active: StdMutex::new(None),\n            next_operation_id: AtomicU64::new(1),\n            _slot: slot,\n        });\n        let mut sessions = self.sessions.write().await;\n        if sessions.contains_key(id) {\n            bail!(\"agent session already exists: {id}\");","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/tdengine/src/runtime.rs#L214-L250","documentation":"Bailed by the TDengine runtime open_session when a session with the requested agentSessionId already exists (after the empty-id check). Sessions are not silently replaced; opening the same id twice is a client-side protocol error, so the second open is refused.","triggerScenarios":"Thrown at agents/drivers/tdengine/src/runtime.rs:232 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a fresh unique agentSessionId for each new session","Close the existing session (close_session) before reopening with the same id","Check the client for accidental duplicate open_session calls"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}