nikivdev/code · error

failed to continue {} session

Error message

failed to continue {} session

What it means

The generic continue launcher in src/ai.rs:5499 bails when its `launched` flag is false after attempting to start the provider CLI's interactive continue flow. Unlike error 77 this is the no-specific-session path: the picker/launch step simply never started for the given provider (Claude/Codex name is interpolated).

Source

Thrown at src/ai.rs:5499

        bail!(
            "failed to continue {} session {} for {}",
            provider_name(sess.provider),
            sess.session_id,
            target.display()
        );
    }

    let launched = match provider {
        Provider::Claude => launch_claude_continue()?,
        Provider::Codex => launch_codex_continue_last_for_target(None, false)?,
        Provider::Cursor => false,
        Provider::All => false,
    };

    if launched {
        Ok(())
    } else {
        bail!("failed to continue {} session", provider_name(provider))
    }
}

/// Quick start: continue last session or create new one with dangerous flags.
pub fn quick_start_session(provider: Provider) -> Result<()> {
    if provider == Provider::Codex {
        let launched = launch_codex_continue_last_for_target(None, false)?;
        if !launched {
            new_session(provider)?;
        }
        return Ok(());
    }

    // Auto-import any new sessions silently
    let _ = auto_import_sessions();

    let sessions = read_sessions_for_project(provider)?;

View on GitHub (pinned to a747e741ae)

Solutions

  1. Confirm the provider CLI binary is installed and on PATH (claude/codex)
  2. Re-run in an interactive terminal tab so the launch can attach
  3. Use a concrete provider (claude/codex) rather than All
  4. Fall back to `f ai <provider> sessions` to verify sessions exist before continuing

Example fix

// before
$ f ai continue  // All -> never launches
// after
$ f ai claude continue
Defensive patterns

Strategy: fallback

Validate before calling

use which::which;
let bin = match provider { Provider::Claude => "claude", Provider::Codex => "codex", _ => return };
if which(bin).is_err() {
    eprintln!("{} CLI not found on PATH; cannot launch continue.", bin);
    return;
}

Type guard

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

Try / catch

match continue_last(provider, path) {
    Err(e) if e.to_string().starts_with("failed to continue") => {
        eprintln!("{e} — falling back to `sessions` listing");
        let _ = provider_sessions(provider, path, true);
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `f ai <provider> continue` (no session id) where the launch branches all fall through to launched=false — e.g. Provider::All reaching the match, or the provider binary missing/launch mechanism failing so no arm sets launched=true.

Common situations: Provider CLI not installed or not on PATH; running in an environment where spawning the interactive process fails; passing provider=All into this launcher from an internal call site.

Related errors


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