openai/codex-plugin-cc · warning · Error

No active Codex jobs to cancel for this session.

Error message

No active Codex jobs to cancel for this session.

What it means

Thrown by resolveCancelableJob() when no reference is supplied, the current session is identified (getCurrentSessionId returns truthy), and zero active jobs exist for that session. It is the session-scoped 'nothing to cancel' state, distinct from error 51 which is the repo-wide equivalent.

Source

Thrown at plugins/codex/scripts/lib/job-control.mjs:304

  if (reference) {
    const selected = matchJobReference(activeJobs, reference);
    if (!selected) {
      throw new Error(`No active job found for "${reference}".`);
    }
    return { workspaceRoot, job: selected };
  }

  const sessionScopedActiveJobs = filterJobsForCurrentSession(activeJobs, options);

  if (sessionScopedActiveJobs.length === 1) {
    return { workspaceRoot, job: sessionScopedActiveJobs[0] };
  }
  if (sessionScopedActiveJobs.length > 1) {
    throw new Error("Multiple Codex jobs are active. Pass a job id to /codex:cancel.");
  }

  if (getCurrentSessionId(options)) {
    throw new Error("No active Codex jobs to cancel for this session.");
  }

  throw new Error("No active Codex jobs to cancel.");
}

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Run /codex:status to confirm there are no active jobs for this session (nothing to cancel).
  2. If an active job exists but is attributed to a different session, pass its id explicitly to bypass session scoping.
  3. Start a new job if cancellation was intended to interrupt live work.

Example fix

// before
resolveCancelableJob(cwd, null, { sessionId: "sess-1" }); // no active in sess-1

// after
const snap = buildStatusSnapshot(cwd, { all: true });
if (snap.running.length === 0) console.log("nothing to cancel");
else resolveCancelableJob(cwd, snap.running[0].id);
Defensive patterns

Strategy: validation

Validate before calling

function sessionHasActiveJobs(jobs, options) {
  return filterJobsForCurrentSession(
    jobs.filter((j) => ["queued", "running"].includes(j.status)),
    options
  ).length > 0;
}

if (!sessionHasActiveJobs(listJobs(workspaceRoot), options)) {
  console.log("No active jobs for this session — nothing to cancel.");
}

Try / catch

try {
  resolveCancelableJob(cwd, null, options);
} catch (err) {
  if (/No active Codex jobs to cancel for this session/.test(err.message)) {
    // benign: nothing to do; optionally check repo-wide
    resolveCancelableJob(cwd, null, {});
  } else throw err;
}

Prevention

When it happens

Trigger: Calling resolveCancelableJob(cwd) with session options set (so a session id is present) when no queued/running jobs belong to that session. Reached via bare /codex:cancel in a session where all jobs finished or none were started.

Common situations: Calling cancel after the session's only job finished; session id mismatch filtering out the active job; bare /codex:cancel reused from a session that has no live work.

Related errors


AI-assisted analysis of openai/codex-plugin-cc@db52e28f4d (2026-08-13). Data as JSON: /api/errors/1e99aa314d979515. Report an issue: GitHub.