Mintplex-Labs/anything-llm · error
Only running or queued jobs can be killed
Error message
Only running or queued jobs can be killed
What it means
State guard on the run kill action: the run exists but its status is neither 'queued' nor 'running', so there is no active execution to terminate and the kill request is rejected as invalid for the run's current state.
Source
Thrown at server/endpoints/scheduledJobs.js:98
await ScheduledJobRun.continueInThread(
Number(request.params.runId)
);
if (error) return response.status(500).json({ error });
return response.status(200).json({
workspaceSlug: workspace.slug,
threadSlug: thread.slug,
});
}
if (action === "kill") {
const run = await ScheduledJobRun.get({
id: Number(request.params.runId),
});
if (!run)
return response.status(404).json({ error: "Run not found" });
if (!["queued", "running"].includes(run.status)) {
return response.status(400).json({
error: "Only running or queued jobs can be killed",
});
}
const killed = backgroundService.killRun(run.jobId, run.id);
if (!killed) await ScheduledJobRun.kill(run.id);
return response.status(200).json({ success: true });
}
} catch {
response.sendStatus(500);
}
}
);
// List all scheduled jobs
app.get(
"/scheduled-jobs",
[validatedRequest, isSingleUserMode],View on GitHub (pinned to 3aec848f28)
Solutions
- Only kill jobs whose status is running or queued.
- Refresh the job status before issuing the kill.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/endpoints/scheduledJobs.js:98 when the library encounters an invalid state.
Common situations: Attempting to kill a scheduled job that already completed or failed.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/e41d111319c3d434.
Report an issue: GitHub.