{"record":{"id":"893a8fd1c4108d87","repo":"aaif-goose/goose","slug":"cannot-use-session-id-without-resume","errorCode":null,"errorMessage":"Cannot use --session-id without --resume","messagePattern":"Cannot use --session-id without --resume","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/cli.rs","lineNumber":451,"sourceCode":"                })?\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\n        let has_user_provided_name = id.name.is_some();\n        let name = id.name.unwrap_or_else(|| \"CLI Session\".to_string());\n        let session = session_manager\n            .create_session(\n                std::env::current_dir()?,\n                name.clone(),\n                SessionType::User,\n                goose_mode,\n            )\n            .await?;\n\n        if has_user_provided_name {\n            session_manager\n                .update(&session.id)\n                .user_provided_name(name)\n                .apply()","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/cli.rs#L433-L469","documentation":"anyhow error from the non-resume branch (crates/goose-cli/src/cli.rs). When starting a fresh chat, the code checks that no --session-id was supplied: a session id only makes sense with --resume, so 'goose --session-id X' without --resume is rejected before any session is created.","triggerScenarios":"Running 'goose --session-id 20250921_143022' (or the --id alias) without --resume; same for 'goose run ... --session-id ...' style invocations where a new session would otherwise be created.","commonSituations":"Copy-pasting a resume command and dropping the --resume flag; assuming --session-id seeds a new session's id (it does not — ids are generated); shell scripts that always pass --session-id.","solutions":["Add --resume: goose --resume --session-id 20250921_143022","If you wanted a new named session, use -n/--name instead of --session-id","Drop --session-id entirely to start a fresh unnamed session"],"exampleFix":"# before\ngoose --session-id 20250921_143022\n\n# after\ngoose --resume --session-id 20250921_143022","handlingStrategy":"validation","validationCode":"if args.session_id.is_some() && !args.resume {\n    return Err(anyhow::anyhow!(\"--session-id requires --resume\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember: --session-id is resume-only in goose","Use -n/--name to label new sessions","Validate flag combinations at script start before long-running work"],"tags":["cli","session","argument-validation","goose"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}