nikivdev/code · error

doctor is only supported for Codex sessions; use `f codex do

Error message

doctor is only supported for Codex sessions; use `f codex doctor`

What it means

The Doctor action (health checks/diagnostics) is implemented only for Codex sessions. run_provider with Provider::Cursor and a Doctor action bails with this message directing the user to `f codex doctor`.

Source

Thrown at src/ai.rs:570

            Some(ProviderAiAction::Copy { session }) => copy_session(session, Provider::Cursor)?,
            Some(ProviderAiAction::Context {
                session,
                count,
                path,
            }) => copy_context(session, Provider::Cursor, count, path)?,
            Some(ProviderAiAction::Show {
                session,
                path,
                count,
                full,
            }) => show_session(session, Provider::Cursor, count, path, full)?,
            Some(ProviderAiAction::Runtime { .. }) => {
                bail!(
                    "runtime helpers are only supported for Codex sessions; use `f codex runtime ...`"
                );
            }
            Some(ProviderAiAction::Doctor { .. }) => {
                bail!("doctor is only supported for Codex sessions; use `f codex doctor`");
            }
            Some(ProviderAiAction::Eval { .. }) => {
                bail!("eval is only supported for Codex sessions; use `f codex eval`");
            }
            Some(ProviderAiAction::TouchLaunch { .. }) => {
                bail!(
                    "touch-launch is only supported for Codex sessions; use `f codex touch-launch`"
                );
            }
            Some(ProviderAiAction::EnableGlobal { .. }) => {
                bail!(
                    "global Codex enablement is only supported for Codex sessions; use `f codex enable-global`"
                );
            }
            Some(ProviderAiAction::Daemon { .. }) => {
                bail!("daemon is only supported for Codex sessions; use `f codex daemon ...`");
            }
            Some(ProviderAiAction::Memory { .. }) => {

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `f codex doctor` for diagnostics
  2. For Cursor issues, use `f cursor list` / `f cursor show` to sanity-check session discovery
  3. Check Cursor CLI installation/config separately from Codex

Example fix

// before
$ f cursor doctor
// error: doctor is only supported for Codex sessions
// after
$ f codex doctor
Defensive patterns

Strategy: validation

Validate before calling

fn assert_codex_for_doctor(provider: &Provider) -> Result<()> {
    if *provider != Provider::Codex {
        bail!("doctor requires the codex provider");
    }
    Ok(())
}

Type guard

fn supports_doctor(p: &Provider) -> bool { matches!(p, Provider::Codex) }

Try / catch

if let Err(e) = run_provider(Provider::Cursor, Some(ProviderAiAction::Doctor { .. })) {
    if e.to_string().contains("doctor is only supported") {
        eprintln!("run diagnostics with: f codex doctor");
    }
}

Prevention

When it happens

Trigger: Running `f cursor doctor` (optionally with doctor flags) instead of `f codex doctor`.

Common situations: Troubleshooting setup and trying the same doctor command across all providers; docs or onboarding scripts assume `f <provider> doctor` is universal.

Related errors


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