nikivdev/code · error

failed to open {} session picker

Error message

failed to open {} session picker

What it means

The session-picker launcher in src/ai.rs:5365 reports failure when its internal `launched` flag ends up false for the given provider, meaning no picker mechanism could be started for that provider. It surfaces the provider name (Claude/Codex/Cursor/All) in the message so the user knows which picker failed to open.

Source

Thrown at src/ai.rs:5365

    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(())
    } else {
        bail!("failed to open {} session picker", provider_name(provider))
    }
}

fn browse_codex_sessions(
    path: Option<String>,
    query: Vec<String>,
    provider: Provider,
) -> Result<()> {
    if provider != Provider::Codex {
        bail!("browse is only supported for Codex sessions; use `f ai codex browse ...`");
    }

    ensure_provider_tty(provider, "browse")?;

    let target = resolve_session_target_path(path.as_deref())?;
    let query_text = query.join(" ").trim().to_string();
    let selection_file = tempfile::NamedTempFile::new()
        .context("failed to create temporary selection file for codex-session-browser")?;

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run the picker with a concrete supported provider: `f ai claude browse` or `f ai codex browse`
  2. Verify the provider CLI binary is installed and on PATH (claude/codex)
  3. Use the non-interactive listing instead: `f ai codex sessions`

Example fix

// before
$ f ai browse   // provider resolves to All, picker never launches
// after
$ f ai codex browse
Defensive patterns

Strategy: fallback

Validate before calling

use which::which;
if which("codex").is_err() && which("claude").is_err() {
    eprintln!("No provider CLI on PATH; session picker cannot launch. Install claude/codex first.");
}

Type guard

fn picker_supported(p: Provider) -> bool {
    matches!(p, Provider::Claude | Provider::Codex)
}

Try / catch

match open_session_picker(provider) {
    Err(e) if e.to_string().contains("failed to open") => {
        eprintln!("{e} — falling back to `f ai codex sessions` listing");
        let _ = provider_sessions(provider, path, true);
    }
    other => other?,
}

Prevention

When it happens

Trigger: Invoking the browse/picker flow for a provider whose launch branch sets launched=false — notably Provider::All or Provider::Cursor, or when the platform/CLI required to spawn the picker is unavailable and the match arms fall through to launched=false.

Common situations: Running the picker against an unsupported provider (All/Cursor); the provider CLI binary not installed or not on PATH so the launch step never succeeds; unsupported platform for the picker integration.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/2fcff0293427a5af. Report an issue: GitHub.