{"record":{"id":"bfb4a11f11a3c4d8","repo":"windmill-labs/windmill","slug":"failed-to-push-queued-jobs-e","errorCode":null,"errorMessage":"Failed to push queued jobs: ${e}","messagePattern":"Failed to push queued jobs: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/jobs/jobs.ts","lineNumber":241,"sourceCode":"    const queuedJobs = JSON.parse(queuedContent);\n\n    if (!Array.isArray(queuedJobs)) {\n      throw new Error(\"Queued jobs file must contain an array of jobs\");\n    }\n\n    const queuedResult = await wmill.importQueuedJobs({\n      workspace: ws.workspaceId,\n      requestBody: queuedJobs,\n    });\n\n    log.info(colors.green(`Queued jobs: ${queuedResult}`));\n  } catch (e: any) {\n    if (e.code === \"ENOENT\") {\n      log.info(\n        colors.yellow(`No queued jobs file found at ${queuedPath}, skipping`)\n      );\n    } else {\n      throw new Error(`Failed to push queued jobs: ${e}`);\n    }\n  }\n}\n\nconst pull = new Command()\n  .description(\"Pull completed and queued jobs from workspace\")\n  .option(\n    \"-c, --completed-output <file:string>\",\n    \"Completed jobs output file (default: completed_jobs.json)\"\n  )\n  .option(\n    \"-q, --queued-output <file:string>\",\n    \"Queued jobs output file (default: queued_jobs.json)\"\n  )\n  .option(\n    \"--skip-worker-check\",\n    \"Skip checking for active workers before export\"\n  )","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/jobs/jobs.ts#L223-L259","documentation":"Generic wrapper error thrown by pushJobs when reading or importing the queued-jobs file fails for any reason other than a missing file (ENOENT, which is treated as 'nothing to push'). It rethrows the original error message embedded in `Failed to push queued jobs: ${e}`, so the underlying cause (parse error, permission error, API failure) is visible in the message text.","triggerScenarios":"Running `wmill job push` when the queued file contains malformed JSON (JSON.parse throws SyntaxError), the file is not readable (EACCES), or `wmill.importQueuedJobs` rejects due to an HTTP/auth/API error.","commonSituations":"A truncated or hand-edited queued_jobs.json with a trailing comma or stray characters; a symlink to a file the current user cannot read; an expired or missing WMILL_TOKEN so the import API call returns 401/403; a workspace id that does not exist.","solutions":["Read the full message after the colon to identify the underlying cause (SyntaxError vs EACCES vs HTTP status).","If it is a JSON parse error, validate the file with `jq . queued_jobs.json` and fix the syntax.","If it is EACCES/EPERM, fix file permissions or run from a directory where queued_jobs.json is readable.","If it is an HTTP error, check `wmill auth login` / WMILL_TOKEN validity and that the target workspace exists."],"exampleFix":"// before: malformed file\n[{\"path\": \"f/a\"},]\n\n// after: valid JSON array\n[{\"path\": \"f/a\"}]","handlingStrategy":"try-catch","validationCode":"const content = await readTextFile(queuedPath).catch(() => null);\nif (content !== null) JSON.parse(content); // throws early with a precise SyntaxError","typeGuard":null,"tryCatchPattern":"try {\n  await pushJobs(opts);\n} catch (e: any) {\n  const cause = String(e.message).replace(\"Failed to push queued jobs: \", \"\");\n  if (/JSON/i.test(cause)) console.error(\"Fix JSON syntax in queued file:\", cause);\n  else if (/EACCES|EPERM/.test(cause)) console.error(\"Check file permissions:\", cause);\n  else if (/401|403/.test(cause)) console.error(\"Re-authenticate with `wmill auth login`\");\n  throw e;\n}","preventionTips":["Pre-validate the queued file with `jq . queued_jobs.json` before running push.","Keep an active login (`wmill auth login`) and confirm the workspace with `wmill workspace show`.","Check the text after the colon in the message — it carries the real root cause."],"tags":["cli","error-handling","network"],"backgroundTag":"wrapped-root-cause-error","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}