Mintplex-Labs/anything-llm · error
Invalid cron expression
Error message
Invalid cron expression
What it means
Validation branch in the create-scheduled-job endpoint: a schedule string was provided but ScheduledJob.isValidCron rejected it, meaning it is not a parseable cron expression the scheduler can safely register.
Source
Thrown at server/endpoints/scheduledJobs.js:160
[validatedRequest, isSingleUserMode],
async (request, response) => {
try {
const { name, prompt, tools, schedule } = reqBody(request);
let errorMessage = null;
if (!name?.trim()) {
errorMessage = "Name is required";
} else if (!prompt?.trim()) {
errorMessage = "Prompt is required";
} else if (!schedule?.trim()) {
errorMessage = "Schedule is required";
} else if (!ScheduledJob.isValidCron(schedule)) {
errorMessage = "Invalid cron expression";
} else if (tools?.length > 0 && !Array.isArray(tools)) {
errorMessage = "Tools must be an array";
}
if (errorMessage)
return response.status(400).json({
job: null,
error: errorMessage,
});
// New jobs default to enabled, so creating one always counts as an
// activation. Reject if it would push us past the configured cap.
const activation = await ScheduledJob.canActivate();
if (!activation.allowed) {
return response.status(400).json({
job: null,
error: `Cannot create: maximum of ${activation.limit} active scheduled jobs reached. Disable another job first.`,
});
}
const { job, error } = await ScheduledJob.create({
name: name.trim(),
prompt: prompt.trim(),
tools: tools || null,View on GitHub (pinned to 3aec848f28)
Solutions
- Fix the cron expression syntax (e.g. '0 9 * * *').
- Validate the expression with a cron parser before submitting.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/endpoints/scheduledJobs.js:160 when the library encounters an invalid state.
Common situations: The supplied schedule string is not a valid cron expression.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/d4c8619e00c91be1.
Report an issue: GitHub.