{"record":{"id":"956d69cc1e3e08e4","repo":"BigPizzaV3/CodexPlusPlus","slug":"session-id-cannot-be-empty","errorCode":null,"errorMessage":"session_id cannot be empty","messagePattern":"session_id cannot be empty","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/models.rs","lineNumber":14,"sourceCode":"#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]\npub struct SessionRef {\n    pub session_id: String,\n    pub title: String,\n}\n\nimpl SessionRef {\n    pub fn new(\n        session_id: impl Into<String>,\n        title: impl Into<String>,\n    ) -> anyhow::Result<SessionRef> {\n        let session_id = session_id.into();\n        if session_id.is_empty() {\n            anyhow::bail!(\"session_id cannot be empty\");\n        }\n\n        Ok(SessionRef {\n            session_id,\n            title: title.into(),\n        })\n    }\n}\n\n#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]\n#[serde(rename_all = \"snake_case\")]\npub enum DeleteStatus {\n    ServerDeleted,\n    LocalDeleted,\n    Partial,\n    Failed,\n    Undone,\n}","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/models.rs#L1-L32","documentation":"SessionRef::new validates that the session identifier is a non-empty string before constructing the SessionRef. An empty session_id would produce a reference that cannot address any session, so the constructor rejects it eagerly.","triggerScenarios":"Calling SessionRef::new(\"\", \"some title\") or SessionRef::new(String::new(), title) — the title may be anything, only session_id is checked.","commonSituations":"Session id read from an uninitialized variable or empty env var; a UI passing a not-yet-selected session; deserializing a record whose id field is missing and defaulting to \"\".","solutions":["Pass the real session id string (e.g. the codex session UUID).","Check the source of the id: only call new() after the id is known non-empty.","If ids come from persisted data, validate on load and skip/surface records with empty ids.","Ensure env vars/config providing the id are set before construction."],"exampleFix":"// before\nSessionRef::new(\"\", \"my session\")?\n// after\nSessionRef::new(\"0f1e2d3c-4b5a-6789-abcd-ef0123456789\", \"my session\")?","handlingStrategy":"validation","validationCode":"fn session_ref_checked(id: &str, title: &str) -> anyhow::Result<SessionRef> {\n    if id.trim().is_empty() {\n        anyhow::bail!(\"session id missing\");\n    }\n    SessionRef::new(id, title)\n}","typeGuard":null,"tryCatchPattern":"match SessionRef::new(id, title) {\n    Ok(r) => /* ... */,\n    Err(e) => { log::error!(\"invalid session ref: {e}\"); skip_or_prompt_for_id(); }\n}","preventionTips":["Only construct SessionRef after the id is obtained from a real session","Validate ids when deserializing persisted session records","Never default missing ids to the empty string; use Option instead","Check env/config sources for the id are non-empty before use"],"tags":["validation","constructor","session","empty-string"],"backgroundTag":"empty-required-field","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}