{"record":{"id":"9fc3e83899bfe3a8","repo":"Mintplex-Labs/anything-llm","slug":"cannot-create-maximum-of-activation-limit-acti","errorCode":null,"errorMessage":"Cannot create: maximum of ${activation.limit} active scheduled jobs reached. Disable another job first.","messagePattern":"Cannot create: maximum of (.+?) active scheduled jobs reached\\. Disable another job first\\.","errorType":"http","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"server/endpoints/scheduledJobs.js","lineNumber":171,"sourceCode":"          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,\n          schedule: schedule.trim(),\n        });\n\n        if (error) {\n          return response.status(400).json({ job: null, error });\n        }\n\n        backgroundService.addScheduledJob(job);\n        Telemetry.sendTelemetry(\"scheduled_job_created\").catch(() => {});\n        return response.status(201).json({ job, error: null });\n      } catch (e) {","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/scheduledJobs.js#L153-L189","documentation":"Capacity error from POST /api/scheduled-jobs. The endpoint counts currently enabled jobs (ScheduledJob.countActive) and rejects creation of a new job — which always starts enabled — when that count has reached ScheduledJob.MAX_ACTIVE; activation.limit in the message echoes the configured cap. In the shipped code MAX_ACTIVE is null (unlimited), so this 400 only fires on deployments where MAX_ACTIVE was set to a positive integer (forks/embedded builds).","triggerScenarios":"POST /api/scheduled-jobs while the number of jobs with enabled=true already equals MAX_ACTIVE. Every create counts as an activation because new jobs default to enabled, so the cap is hit one create earlier than a total-job count would suggest.","commonSituations":"Automation or agent-skill flows that mint scheduled jobs on every invocation without disabling old ones; test scripts creating many jobs; forking AnythingLLM and setting MAX_ACTIVE to bound scheduler load.","solutions":["Disable or delete an existing enabled job first (PUT /api/scheduled-jobs/:id with {\"enabled\":false}, or DELETE), then retry the create","Audit enabled jobs with GET /api/scheduled-jobs and prune ones you no longer need","If the cap is wrong for your deployment, adjust ScheduledJob.MAX_ACTIVE in server/models/scheduledJob.js — there is no env/config option yet (marked @todo)"],"exampleFix":"// before — create while at the cap\nawait api.post('/scheduled-jobs', newJob); // 400 max active reached\n\n// after — free a slot, then create\nawait api.put(`/scheduled-jobs/${staleJobId}`, { enabled: false });\nawait api.post('/scheduled-jobs', newJob);","handlingStrategy":"validation","validationCode":"// Count enabled jobs before creating a new one\nconst { jobs } = await api.get('/scheduled-jobs');\nconst enabledCount = jobs.filter(j => j.enabled).length;\nif (MAX_ACTIVE !== null && enabledCount >= MAX_ACTIVE) {\n  await api.put(`/scheduled-jobs/${pickDisposable(jobs).id}`, { enabled: false });\n}\nawait api.post('/scheduled-jobs', newJob);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Automations should disable-before-create when a cap is configured","Track the active-job count in the UI so users see the cap coming","Document that every create is an activation because new jobs start enabled"],"tags":["scheduled-jobs","capacity","api","rate-limit"],"backgroundTag":"resource-limit-reached","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"}