{"record":{"id":"7983f1a2140eee21","repo":"nikivdev/code","slug":"sessions-requires-a-specific-provider-claude-or-c","errorCode":null,"errorMessage":"sessions requires a specific provider (claude or codex)","messagePattern":"sessions requires a specific provider \\(claude or codex\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ai.rs","lineNumber":5345,"sourceCode":"                \"\",\n                line,\n                index_width = index_width,\n                updated_width = updated_width,\n                id_width = id_width,\n            );\n        }\n    }\n\n    println!();\n    for hint in provider_session_listing_hints(provider, target, &rows, &display_ids) {\n        println!(\"{hint}\");\n    }\n    Ok(())\n}\n\nfn provider_sessions(provider: Provider, path: Option<String>, json: bool) -> Result<()> {\n    if provider == Provider::All {\n        bail!(\"sessions requires a specific provider (claude or codex)\");\n    }\n    if provider == Provider::Codex {\n        let target = resolve_session_target_path(path.as_deref())?;\n        let sessions = read_sessions_for_target(provider, path.as_deref())?;\n        return print_provider_session_listing(provider, &target, &sessions, json);\n    }\n\n    ensure_provider_tty(provider, \"sessions\")?;\n\n    let launched = match provider {\n        Provider::Claude => launch_claude_resume_picker()?,\n        Provider::Codex => launch_codex_resume_picker()?,\n        Provider::Cursor => false,\n        Provider::All => false,\n    };\n\n    if launched {\n        Ok(())","sourceCodeStart":5327,"sourceCodeEnd":5363,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/ai.rs#L5327-L5363","documentation":"provider_sessions in src/ai.rs:5345 rejects the generic Provider::All value because the sessions subcommand can only list sessions for one concrete provider. Listing across all providers is unsupported, so passing the aggregate provider selection bails immediately before any session files are read.","triggerScenarios":"Invoking the `sessions` subcommand without narrowing the provider so that Provider::All reaches provider_sessions — e.g. a bare `f ai sessions` or CLI wiring that defaults to All instead of claude/codex.","commonSituations":"Forgetting the provider argument when typing the command; shell alias or script that omits the provider; misconfigured CLI parser defaulting the provider to All.","solutions":["Specify the provider explicitly: `f ai claude sessions` or `f ai codex sessions`","If scripting, default the provider variable to \"claude\" or \"codex\" instead of \"all\"","Check argument parsing/aliases that may drop the provider token"],"exampleFix":"// before\n$ f ai sessions\n// after\n$ f ai codex sessions","handlingStrategy":"validation","validationCode":"if provider == \"all\" || provider.is_empty() {\n    eprintln!(\"sessions requires a provider: `f ai claude sessions` or `f ai codex sessions`\");\n    std::process::exit(2);\n}","typeGuard":"fn is_concrete_provider(p: &str) -> bool {\n    matches!(p, \"claude\" | \"codex\")\n}","tryCatchPattern":"match run_sessions(provider) {\n    Err(e) if e.to_string().contains(\"requires a specific provider\") => {\n        eprintln!(\"{e} — pass claude or codex explicitly\");\n    }\n    other => other?,\n}","preventionTips":["Always include claude or codex in ai subcommand invocations","Avoid defaulting provider variables to \"all\" in scripts","Add shell completion/aliases that require the provider token"],"tags":["cli","argument-validation","provider-selection"],"backgroundTag":"missing-required-argument","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}