openai/codex-plugin-cc · error · Error

Missing required --job-id for task-worker.

Error message

Missing required --job-id for task-worker.

What it means

handleTaskWorker is the detached background worker entrypoint spawned by spawnDetachedTaskWorker. It requires --job-id to load the stored job that contains the task request. Without it there is nothing to execute. The value options parsed are only cwd and job-id.

Source

Thrown at plugins/codex/scripts/codex-companion.mjs:844

  const { options } = parseCommandInput(argv, {
    valueOptions: ["cwd", "source"],
    booleanOptions: ["json"]
  });

  const cwd = resolveCommandCwd(options);
  const { payload, rendered } = await executeTransfer(cwd, {
    source: options.source
  });
  outputCommandResult(payload, rendered, options.json);
}

async function handleTaskWorker(argv) {
  const { options } = parseCommandInput(argv, {
    valueOptions: ["cwd", "job-id"]
  });

  if (!options["job-id"]) {
    throw new Error("Missing required --job-id for task-worker.");
  }

  const cwd = resolveCommandCwd(options);
  const workspaceRoot = resolveCommandWorkspace(options);
  const storedJob = readStoredJob(workspaceRoot, options["job-id"]);
  if (!storedJob) {
    throw new Error(`No stored job found for ${options["job-id"]}.`);
  }

  const request = storedJob.request;
  if (!request || typeof request !== "object") {
    throw new Error(`Stored job ${options["job-id"]} is missing its task request payload.`);
  }

  const { logFile, progress } = createTrackedProgress(
    {
      ...storedJob,
      workspaceRoot

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Do not invoke task-worker directly; it is an internal subcommand launched by the background task path.
  2. If debugging, pass a valid --job-id that exists in the workspace state: task-worker --cwd <path> --job-id <id>.
  3. Ensure spawnDetachedTaskWorker receives a non-empty jobId from buildTaskJob/generateJobId.

Example fix

// before
codex-companion.mjs task-worker
// after
codex-companion.mjs task-worker --cwd /repo --job-id task-abc123
Defensive patterns

Strategy: validation

Validate before calling

if (!options['job-id']) throw new Error('--job-id required');

Prevention

When it happens

Trigger: The worker is normally spawned internally with --job-id; this error surfaces if someone invokes task-worker manually without --job-id, or if spawnDetachedTaskWorker's argument construction is broken so job.id is empty.

Common situations: Manual debugging of the worker subprocess, or a bug in enqueueBackgroundTask where job.id is undefined and the spawned argv lacks a value.

Related errors


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