{"record":{"id":"a9992194fd966dac","repo":"windmill-labs/windmill","slug":"failed-to-re-run-job-id","errorCode":null,"errorMessage":"Failed to re-run job ${id}.","messagePattern":"Failed to re-run job (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/job/job.ts","lineNumber":409,"sourceCode":"      job_ids: [id],\n      script_options_by_path: {},\n      flow_options_by_path: {},\n    },\n  });\n\n  const newIds: string[] = [];\n  const errorLines: string[] = [];\n  for (const line of String(response).split(\"\\n\")) {\n    const trimmed = line.trim();\n    if (!trimmed) continue;\n    if (trimmed.startsWith(\"Error:\")) errorLines.push(trimmed);\n    else newIds.push(trimmed);\n  }\n\n  for (const err of errorLines) log.error(err);\n\n  if (newIds.length === 0) {\n    throw new Error(`Failed to re-run job ${id}.`);\n  }\n\n  console.log(newIds[0]);\n}\n\nasync function restart(\n  opts: GlobalOptions & { step: string; iteration?: number },\n  id: string\n) {\n  log.setSilent(true);\n  opts = await mergeConfigWithConfigFile(opts);\n  const workspace = await resolveWorkspace(opts);\n  await requireLogin(opts);\n\n  const newId = await wmill.restartFlowAtStep({\n    workspace: workspace.workspaceId,\n    id,\n    requestBody: {","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/job/job.ts#L391-L427","documentation":"The 'wmill job rerun' command attempts to rerun each given job id (or a file of ids), collecting failures. If every rerun attempt failed so that no new job ids were produced, it throws this error naming the original job id.","triggerScenarios":"Rerunning a job whose run cannot be recreated server-side: the underlying script/flow was deleted, the job id is wrong, the job type isn't rerunnable, or the workspace token lacks permission — for all provided ids so newIds ends up empty.","commonSituations":"Rerunning after the script was deleted or renamed; stale job id copied from another workspace; token without write permissions; rerunning a large ids file where every line failed (the errorLines above list why).","solutions":["Read the errorLines printed just above — they contain the per-id server error and point to the root cause","Verify the job id exists in the target workspace ('wmill job list' or UI) and the script/flow still exists","Check your token/workspace has permission to create new runs","Retry the rerun for a subset of ids to isolate which ones work"],"exampleFix":"// before\nwmill job rerun deadbeef  # script deleted -> fails\n// after\nwmill job list | grep deadbeef  # confirm job & script exist\nwmill job rerun <valid-id>","handlingStrategy":"try-catch","validationCode":"// confirm the job and its runnable still exist before rerun\nconst job = await wmill.getJob({ workspace, id });\nif (!job) throw new Error(`Job ${id} not found in workspace`);\nconst runnable = job.script_path\n  ? await wmill.getScriptByPath({ workspace, path: job.script_path }).catch(() => null)\n  : null;\nif (job.script_path && !runnable) throw new Error(`Script ${job.script_path} no longer exists`);","typeGuard":null,"tryCatchPattern":"try {\n  await wmillJobRerun(id);\n} catch (e) {\n  if (String(e).includes(\"Failed to re-run job\")) {\n    console.error(`Rerun of ${id} failed entirely; check the per-id error lines printed above and that the script/flow still exists`);\n  }\n}","preventionTips":["Don't delete scripts/flows that scheduled or referenced jobs may rerun","Copy job ids from the same workspace you run rerun in","Ensure your token has permission to create runs","Rerun in small batches so one bad id doesn't mask others (read errorLines)"],"tags":["cli","jobs","api"],"backgroundTag":"job-rerun-failed","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"}