{"record":{"id":"452cdcd85e2ae079","repo":"affaan-m/ECC","slug":"session-not-found-resolved-id","errorCode":null,"errorMessage":"Session not found: {resolved_id}","messagePattern":"Session not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/main.rs","lineNumber":2009,"sourceCode":"            patch,\n            check,\n        }) => {\n            if all && session_id.is_some() {\n                return Err(anyhow::anyhow!(\n                    \"worktree-status does not accept a session ID when --all is set\"\n                ));\n            }\n            let reports = if all {\n                session::manager::list_sessions(&db)?\n                    .into_iter()\n                    .map(|session| build_worktree_status_report(&session, patch))\n                    .collect::<Result<Vec<_>>>()?\n            } else {\n                let id = session_id.unwrap_or_else(|| \"latest\".to_string());\n                let resolved_id = resolve_session_id(&db, &id)?;\n                let session = db\n                    .get_session(&resolved_id)?\n                    .ok_or_else(|| anyhow::anyhow!(\"Session not found: {resolved_id}\"))?;\n                vec![build_worktree_status_report(&session, patch)?]\n            };\n            if json {\n                if all {\n                    println!(\"{}\", serde_json::to_string_pretty(&reports)?);\n                } else {\n                    println!(\"{}\", serde_json::to_string_pretty(&reports[0])?);\n                }\n            } else {\n                println!(\"{}\", format_worktree_status_reports_human(&reports));\n            }\n            if check {\n                std::process::exit(worktree_status_reports_exit_code(&reports));\n            }\n        }\n        Some(Commands::WorktreeResolution {\n            session_id,\n            all,","sourceCodeStart":1991,"sourceCodeEnd":2027,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/ecc2/src/main.rs#L1991-L2027","documentation":"Runtime error from the WorktreeStatus command handler in ecc2/src/main.rs. In the single-session branch (not --all), the handler resolves the id via resolve_session_id and calls db.get_session(&resolved_id); on None it bails with \"Session not found: {resolved_id}\". The default id is the literal \"latest\", so the error can also fire when there are no sessions at all.","triggerScenarios":"Running `worktree-status <id>` (or with no id, which defaults to \"latest\") where the resolved id does not exist in the database. Also fires when the database is empty and \"latest\" resolves to a non-existent sentinel.","commonSituations":"Empty session database and the user omitted the id (so it defaults to \"latest\"); typo in the id; the session was deleted; wrong workspace database selected.","solutions":["Run `sessions list` (or equivalent) to confirm the id and that any session exists.","If the database is empty, create a session before asking for its worktree status.","Pass the exact resolved id rather than relying on \"latest\".","Check you are pointed at the right project/workspace database."],"exampleFix":"# before\n$ ecc worktree-status\nError: Session not found: latest\n\n# after\n$ ecc sessions list   # confirm sessions exist\n$ ecc worktree-status <exact-id>","handlingStrategy":"validation","validationCode":"// Special-case the 'latest' default against an empty database.\nlet id = session_id.as_deref().unwrap_or(\"latest\");\nif id == \"latest\" && session::manager::list_sessions(&db)?.is_empty() {\n    eprintln!(\"no sessions exist; create one before requesting worktree status\");\n    return Ok(());\n}","typeGuard":"fn session_exists(db: &Db, id: &str) -> bool {\n    db.get_session(id).map(|o| o.is_some()).unwrap_or(false)\n}","tryCatchPattern":"let session = db.get_session(&resolved_id)?.ok_or_else(|| {\n    eprintln!(\"tip: run `ecc sessions list`\");\n    anyhow::anyhow!(\"Session not found: {resolved_id}\")\n})?;","preventionTips":["List sessions before requesting status on one.","Pass an explicit id rather than relying on the 'latest' default.","Confirm the database is the right one for the project.","Create a session first when the database is empty."],"tags":["rust","session","cli","worktree"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}