nikivdev/code · error
sessions requires a specific provider (claude or codex)
Error message
sessions requires a specific provider (claude or codex)
What it means
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.
Source
Thrown at src/ai.rs:5345
"",
line,
index_width = index_width,
updated_width = updated_width,
id_width = id_width,
);
}
}
println!();
for hint in provider_session_listing_hints(provider, target, &rows, &display_ids) {
println!("{hint}");
}
Ok(())
}
fn provider_sessions(provider: Provider, path: Option<String>, json: bool) -> Result<()> {
if provider == Provider::All {
bail!("sessions requires a specific provider (claude or codex)");
}
if provider == Provider::Codex {
let target = resolve_session_target_path(path.as_deref())?;
let sessions = read_sessions_for_target(provider, path.as_deref())?;
return print_provider_session_listing(provider, &target, &sessions, json);
}
ensure_provider_tty(provider, "sessions")?;
let launched = match provider {
Provider::Claude => launch_claude_resume_picker()?,
Provider::Codex => launch_codex_resume_picker()?,
Provider::Cursor => false,
Provider::All => false,
};
if launched {
Ok(())View on GitHub (pinned to a747e741ae)
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
Example fix
// before $ f ai sessions // after $ f ai codex sessions
Defensive patterns
Strategy: validation
Validate before calling
if provider == "all" || provider.is_empty() {
eprintln!("sessions requires a provider: `f ai claude sessions` or `f ai codex sessions`");
std::process::exit(2);
} Type guard
fn is_concrete_provider(p: &str) -> bool {
matches!(p, "claude" | "codex")
} Try / catch
match run_sessions(provider) {
Err(e) if e.to_string().contains("requires a specific provider") => {
eprintln!("{e} — pass claude or codex explicitly");
}
other => other?,
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Forgetting the provider argument when typing the command; shell alias or script that omits the provider; misconfigured CLI parser defaulting the provider to All.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- continue requires a specific provider (claude or codex)
- --all cannot be combined with HASH. Use `f commit-queue appr
- --path cannot be used with --no-commit or --hash
- unknown `f pr feedback` option: {token}
- multiple PR selectors provided. Use exactly one selector.
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/7983f1a2140eee21.
Report an issue: GitHub.