{"record":{"id":"8953c686e3dd250e","repo":"openai/codex-plugin-cc","slug":"stored-job-options-job-id-is-missing-its-tas","errorCode":null,"errorMessage":"Stored job ${options[\"job-id\"]} is missing its task request payload.","messagePattern":"Stored job (.+?) is missing its task request payload\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/codex/scripts/codex-companion.mjs","lineNumber":856,"sourceCode":"async function handleTaskWorker(argv) {\n  const { options } = parseCommandInput(argv, {\n    valueOptions: [\"cwd\", \"job-id\"]\n  });\n\n  if (!options[\"job-id\"]) {\n    throw new Error(\"Missing required --job-id for task-worker.\");\n  }\n\n  const cwd = resolveCommandCwd(options);\n  const workspaceRoot = resolveCommandWorkspace(options);\n  const storedJob = readStoredJob(workspaceRoot, options[\"job-id\"]);\n  if (!storedJob) {\n    throw new Error(`No stored job found for ${options[\"job-id\"]}.`);\n  }\n\n  const request = storedJob.request;\n  if (!request || typeof request !== \"object\") {\n    throw new Error(`Stored job ${options[\"job-id\"]} is missing its task request payload.`);\n  }\n\n  const { logFile, progress } = createTrackedProgress(\n    {\n      ...storedJob,\n      workspaceRoot\n    },\n    {\n      logFile: storedJob.logFile ?? null\n    }\n  );\n  await runTrackedJob(\n    {\n      ...storedJob,\n      workspaceRoot,\n      logFile\n    },\n    () =>","sourceCodeStart":838,"sourceCodeEnd":874,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/codex-companion.mjs#L838-L874","documentation":"Even when a stored job file exists, it must contain a request object (the task payload written by enqueueBackgroundTask as queuedRecord.request). If request is null/undefined or not an object, the worker has no prompt/model/effort to run with, so it aborts. This indicates a corrupted or incomplete job file.","triggerScenarios":"The job file was written without a request field (e.g. an older version of the code, a manual edit, or a partially-written file from a crash during writeJobFile). Also if a non-task job file is mistakenly loaded by task-worker.","commonSituations":"Version mismatch where older job records lack request; filesystem corruption; a race where the file is read before the request field is flushed.","solutions":["Re-enqueue the task to write a complete job record with the request payload.","Inspect the job file in the state directory to confirm it has a request object; repair or delete it.","Ensure writeJobFile/upsertJob in enqueueBackgroundTask always include the request field."],"exampleFix":"// before (job file has no request)\n// state file: { \"id\": \"task-abc\", \"status\": \"queued\" }\n// after: re-enqueue so the record includes request\ncodex-companion.mjs task --background \"prompt\"","handlingStrategy":"type-guard","validationCode":"if (!storedJob.request || typeof storedJob.request !== 'object') {\n  throw new Error('job record missing request');\n}","typeGuard":"/** @param {object} j @returns {j is {request: object}} */\nfunction hasTaskRequest(j) {\n  return j != null && j.request != null && typeof j.request === 'object';\n}","tryCatchPattern":null,"preventionTips":["Always write the request field when persisting a job record.","Validate job files after migration between versions."],"tags":["state","worker","data-integrity","job"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}