{"record":{"id":"7ed7691abdd6ae4d","repo":"aaif-goose/goose","slug":"invalid-identifier","errorCode":null,"errorMessage":"Invalid identifier","messagePattern":"Invalid identifier","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/cli.rs","lineNumber":435,"sourceCode":"\n        if let Some(session_id) = id.session_id {\n            session_id\n        } else if let Some(name) = id.name {\n            let sessions = session_manager.list_sessions().await?;\n            sessions\n                .into_iter()\n                .find(|s| s.name == name || s.id == name)\n                .map(|s| s.id)\n                .ok_or_else(|| anyhow::anyhow!(\"No session found with name '{}'\", name))?\n        } else if let Some(path) = id.path {\n            path.file_stem()\n                .and_then(|s| s.to_str())\n                .map(|s| s.to_string())\n                .ok_or_else(|| {\n                    anyhow::anyhow!(\"Could not extract session ID from path: {:?}\", path)\n                })?\n        } else {\n            return Err(anyhow::anyhow!(\"Invalid identifier\"));\n        }\n    } else {\n        let Some(id) = identifier else {\n            let session = session_manager\n                .create_session(\n                    std::env::current_dir()?,\n                    \"CLI Session\".to_string(),\n                    SessionType::User,\n                    goose_mode,\n                )\n                .await?;\n            return Ok(Some(session.id));\n        };\n\n        if id.session_id.is_some() {\n            return Err(anyhow::anyhow!(\"Cannot use --session-id without --resume\"));\n        }\n","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/cli.rs#L417-L453","documentation":"anyhow error from the resume branch (crates/goose-cli/src/cli.rs) when the parsed Identifier has none of session_id, name, or path set. Identifier is a clap ArgGroup(required=false, multiple=false); in the resume flow an all-None identifier should normally take the 'most recent session' path, so hitting this branch means an explicitly empty identifier reached code that requires a value — effectively unreachable via the public CLI today.","triggerScenarios":"Programmatically constructing Identifier::default() (all fields None) and calling the resolution function directly, or a future CLI change that routes an empty identifier into the per-field match instead of the fallback.","commonSituations":"Unit tests or embedded callers building Identifier by hand; refactors of the clap group that change which arm executes.","solutions":["If calling from code, set at least one field: id.name / id.session_id / id.path","Prefer letting the no-identifier path run (pass Option::None for the whole identifier) so it resolves the most recent session","Keep the ArgGroup contract (required=false, multiple=false) intact when editing the CLI","For scripts, pass an explicit --session-id to make intent unambiguous"],"exampleFix":"// before\nlet id = Identifier::default(); // all None\nresolve(id).await?;\n\n// after\nlet id = Identifier { name: Some(\"project-x\".into()), ..Default::default() };\nresolve(id).await?;","handlingStrategy":"validation","validationCode":"debug_assert!(id.session_id.is_some() || id.name.is_some() || id.path.is_some(), \"Identifier must carry a value in the resume per-field branch\");","typeGuard":"fn identifier_has_value(id: &Identifier) -> bool {\n    id.session_id.is_some() || id.name.is_some() || id.path.is_some()\n}","tryCatchPattern":null,"preventionTips":["Construct Identifier with at least one field in code","Pass Option::None for the whole identifier when you want 'most recent session' behavior","Keep the clap ArgGroup contract intact"],"tags":["cli","session","identifier","unreachable-code"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}