{"record":{"id":"0b9fa9e62575052c","repo":"aaif-goose/goose","slug":"could-not-extract-session-id-from-path","errorCode":null,"errorMessage":"Could not extract session ID from path: {:?}","messagePattern":"Could not extract session ID from path: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/cli.rs","lineNumber":432,"sourceCode":"                .ok_or_else(|| anyhow::anyhow!(\"No session found to resume\"))?;\n            return Ok(Some(session_id));\n        };\n\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() {","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/cli.rs#L414-L450","documentation":"anyhow error from the resume branch (crates/goose-cli/src/cli.rs) when --path was supplied and Path::file_stem() returns None or the stem is not valid UTF-8. file_stem fails for paths whose last component is '..' (no stem) or a path like '/'; to_str() fails for non-UTF-8 bytes in the filename.","triggerScenarios":"Passing --path ., --path .., --path /, or a legacy session file path whose filename contains non-UTF-8 bytes. Normal '/path/to/20250325_200615.jsonl' works; only degenerate or non-UTF-8 paths hit this error.","commonSituations":"Passing a directory instead of the .jsonl file (e.g. --path ~/goose/sessions/), shell glob expanding to '..' or an empty result, filenames with invalid encoding after a filesystem migration.","solutions":["Pass the full path to the session .jsonl file, not a directory: --path /path/to/20250325_200615.jsonl","Avoid '.', '..', and '/' as the path value","If the filename has non-UTF-8 bytes, rename the file to a UTF-8 name first","Prefer the modern form instead: --resume --session-id 20250325_200615"],"exampleFix":"# before\ngoose --resume --path ~/goose/sessions/\n\n# after\ngoose --resume --path ~/goose/sessions/20250325_200615.jsonl\ngoose --resume --session-id 20250325_200615  # preferred","handlingStrategy":"validation","validationCode":"let ok = path.is_file() && path.file_stem().and_then(|s| s.to_str()).is_some();\nif !ok { /* reject early: pass the .jsonl file path, not a directory */ }","typeGuard":"fn usable_session_path(path: &Path) -> bool {\n    path.is_file() && path.file_stem().and_then(|s| s.to_str()).is_some()\n}","tryCatchPattern":null,"preventionTips":["Pass the full .jsonl file path, never a directory or '..'","Prefer the modern --session-id form over legacy --path","Sanitize non-UTF-8 filenames before passing them"],"tags":["cli","session","path","resume"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}