nikivdev/code · error

agent is only supported for Codex sessions; use `f codex age

Error message

agent is only supported for Codex sessions; use `f codex agent ...`

What it means

Raised by `run_provider` in src/ai.rs when the `agent` action is dispatched against a Cursor session. Agent orchestration is a Codex-only integration; the Cursor dispatch rejects it with `bail!` and directs the user to `f codex agent ...`.

Source

Thrown at src/ai.rs:615

                bail!("trace is only supported for Codex sessions; use `f codex trace ...`");
            }
            Some(ProviderAiAction::ProjectAi { .. }) => {
                bail!(
                    "project-ai is only supported for Codex sessions; use `f codex project-ai ...`"
                );
            }
            Some(ProviderAiAction::SkillEval { .. }) => {
                bail!(
                    "skill-eval is only supported for Codex sessions; use `f codex skill-eval ...`"
                );
            }
            Some(ProviderAiAction::SkillSource { .. }) => {
                bail!(
                    "skill-source is only supported for Codex sessions; use `f codex skill-source ...`"
                );
            }
            Some(ProviderAiAction::Agent { .. }) => {
                bail!("agent is only supported for Codex sessions; use `f codex agent ...`");
            }
            Some(ProviderAiAction::Log { .. }) => {
                bail!("log is only supported for Codex sessions; use `f codex log ...`");
            }
            Some(ProviderAiAction::Sessions { .. })
            | Some(ProviderAiAction::Browse { .. })
            | Some(ProviderAiAction::Continue { .. })
            | Some(ProviderAiAction::New)
            | Some(ProviderAiAction::Open { .. })
            | Some(ProviderAiAction::Resolve { .. })
            | Some(ProviderAiAction::Resume { .. })
            | Some(ProviderAiAction::Find { .. })
            | Some(ProviderAiAction::FindAndCopy { .. }) => {
                bail!(
                    "Cursor transcripts are readable only; use `f cursor list`, `f cursor copy`, or `f cursor context`"
                );
            }
            Some(ProviderAiAction::Recover { .. }) => {

View on GitHub (pinned to a747e741ae)

Solutions

  1. Use `f codex agent ...` instead
  2. Restrict Cursor interaction to the read-only trio: `f cursor list`, `f cursor copy`, `f cursor context`
  3. Branch on provider in automation before invoking Agent
  4. Remove/alias-correct any `f cursor agent` shortcuts in shell configs

Example fix

// before
f cursor agent run task
// after
f codex agent run task
Defensive patterns

Strategy: validation

Validate before calling

fn supports_agent(provider: Provider) -> bool {
    matches!(provider, Provider::Codex)
}
if !supports_agent(provider) {
    eprintln!("agent requires Codex: use `f codex agent ...`");
    return;
}

Type guard

fn is_codex(provider: Provider) -> bool {
    matches!(provider, Provider::Codex)
}

Try / catch

if let Err(e) = run_provider(provider, Some(ProviderAiAction::Agent { .. })) {
    if e.to_string().contains("agent is only supported for Codex") {
        eprintln!("rerun as: f codex agent ...");
    } else {
        return Err(e);
    }
}

Prevention

When it happens

Trigger: Running `f cursor agent ...`, or run_provider(Provider::Cursor, Some(ProviderAiAction::Agent{..})). Triggered whenever agent automation targets the Cursor provider.

Common situations: Agent pipelines migrated from Codex but still pointing at Cursor transcripts, tab-completion guesses that every provider supports `agent`, shared dotfiles with provider-agnostic aliases.

Related errors


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