windmill-labs/windmill · error · Error
Failed to re-run job ${id}.
Error message
Failed to re-run job ${id}. What it means
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.
Source
Thrown at cli/src/commands/job/job.ts:409
job_ids: [id],
script_options_by_path: {},
flow_options_by_path: {},
},
});
const newIds: string[] = [];
const errorLines: string[] = [];
for (const line of String(response).split("\n")) {
const trimmed = line.trim();
if (!trimmed) continue;
if (trimmed.startsWith("Error:")) errorLines.push(trimmed);
else newIds.push(trimmed);
}
for (const err of errorLines) log.error(err);
if (newIds.length === 0) {
throw new Error(`Failed to re-run job ${id}.`);
}
console.log(newIds[0]);
}
async function restart(
opts: GlobalOptions & { step: string; iteration?: number },
id: string
) {
log.setSilent(true);
opts = await mergeConfigWithConfigFile(opts);
const workspace = await resolveWorkspace(opts);
await requireLogin(opts);
const newId = await wmill.restartFlowAtStep({
workspace: workspace.workspaceId,
id,
requestBody: {View on GitHub (pinned to e474e8803c)
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
Example fix
// before wmill job rerun deadbeef # script deleted -> fails // after wmill job list | grep deadbeef # confirm job & script exist wmill job rerun <valid-id>
Defensive patterns
Strategy: try-catch
Validate before calling
// confirm the job and its runnable still exist before rerun
const job = await wmill.getJob({ workspace, id });
if (!job) throw new Error(`Job ${id} not found in workspace`);
const runnable = job.script_path
? await wmill.getScriptByPath({ workspace, path: job.script_path }).catch(() => null)
: null;
if (job.script_path && !runnable) throw new Error(`Script ${job.script_path} no longer exists`); Try / catch
try {
await wmillJobRerun(id);
} catch (e) {
if (String(e).includes("Failed to re-run job")) {
console.error(`Rerun of ${id} failed entirely; check the per-id error lines printed above and that the script/flow still exists`);
}
} Prevention
- 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)
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- Failed to push completed jobs: ${e}
- Completed jobs file must contain an array of jobs
- Failed to fetch schema for ${runnable.runType} ${runnable.pa
- Could not fetch datatable schemas: ${errorMessage}
- Failed to create folder ${name}: ${e.body ?? e.message}
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/a9992194fd966dac.
Report an issue: GitHub.