{"record":{"id":"d1bea3ff3957bffc","repo":"Mintplex-Labs/anything-llm","slug":"schedule-is-required","errorCode":null,"errorMessage":"Schedule is required","messagePattern":"Schedule is required","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/endpoints/scheduledJobs.js","lineNumber":160,"sourceCode":"    [validatedRequest, isSingleUserMode],\n    async (request, response) => {\n      try {\n        const { name, prompt, tools, schedule } = reqBody(request);\n        let errorMessage = null;\n\n        if (!name?.trim()) {\n          errorMessage = \"Name is required\";\n        } else if (!prompt?.trim()) {\n          errorMessage = \"Prompt is required\";\n        } else if (!schedule?.trim()) {\n          errorMessage = \"Schedule is required\";\n        } else if (!ScheduledJob.isValidCron(schedule)) {\n          errorMessage = \"Invalid cron expression\";\n        } else if (tools?.length > 0 && !Array.isArray(tools)) {\n          errorMessage = \"Tools must be an array\";\n        }\n        if (errorMessage)\n          return response.status(400).json({\n            job: null,\n            error: errorMessage,\n          });\n\n        // New jobs default to enabled, so creating one always counts as an\n        // activation. Reject if it would push us past the configured cap.\n        const activation = await ScheduledJob.canActivate();\n        if (!activation.allowed) {\n          return response.status(400).json({\n            job: null,\n            error: `Cannot create: maximum of ${activation.limit} active scheduled jobs reached. Disable another job first.`,\n          });\n        }\n\n        const { job, error } = await ScheduledJob.create({\n          name: name.trim(),\n          prompt: prompt.trim(),\n          tools: tools || null,","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/scheduledJobs.js#L142-L178","documentation":"Validation branch in the create-scheduled-job endpoint: the schedule field from the request body is empty or whitespace-only, so the job has no cron schedule to execute and the request is rejected with the validation message.","triggerScenarios":"Thrown at server/endpoints/scheduledJobs.js:160 when the library encounters an invalid state.","commonSituations":"Creating a scheduled job without a schedule.","solutions":["Provide a cron schedule for the job.","Use a standard 5-field cron expression."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}