{"record":{"id":"6ee43f3b224b17c5","repo":"mastra-ai/mastra","slug":"schedules-invalid-status","errorCode":"SCHEDULES_INVALID_STATUS","errorMessage":"Schedule${where}: unknown status \"${definition.status}\". Expected one of: ${SCHEDULE_STATUSES.join(', ')}.","messagePattern":"Schedule(.+?): unknown status \"(.+?)\"\\. Expected one of: (.+?)\\.","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/schedules/define.ts","lineNumber":216,"sourceCode":"      error,\n    );\n  }\n\n  // Markdown schedules never pass through TypeScript, so these enum-ish fields\n  // are only checked here. An unchecked value would reach schedule storage and\n  // surface as a confusing runtime failure on the first fire.\n  if (definition.signalType !== undefined && !SCHEDULE_SIGNAL_TYPES.includes(definition.signalType)) {\n    throw new MastraError({\n      id: 'SCHEDULES_INVALID_SIGNAL_TYPE',\n      domain: ErrorDomain.AGENT,\n      category: ErrorCategory.USER,\n      details: { label: label ?? '', signalType: String(definition.signalType) },\n      text: `Schedule${where}: unknown signalType \"${definition.signalType}\". Expected one of: ${SCHEDULE_SIGNAL_TYPES.join(', ')}.`,\n    });\n  }\n\n  if (definition.status !== undefined && !SCHEDULE_STATUSES.includes(definition.status)) {\n    throw new MastraError({\n      id: 'SCHEDULES_INVALID_STATUS',\n      domain: ErrorDomain.AGENT,\n      category: ErrorCategory.USER,\n      details: { label: label ?? '', status: String(definition.status) },\n      text: `Schedule${where}: unknown status \"${definition.status}\". Expected one of: ${SCHEDULE_STATUSES.join(', ')}.`,\n    });\n  }\n\n  if (definition.threadId && !definition.resourceId) {\n    throw new MastraError({\n      id: 'SCHEDULES_MISSING_RESOURCE_ID',\n      domain: ErrorDomain.AGENT,\n      category: ErrorCategory.USER,\n      details: { label: label ?? '' },\n      text: `Schedule${where}: 'resourceId' is required when 'threadId' is set.`,\n    });\n  }\n}","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/schedules/define.ts#L198-L234","documentation":"The schedule definition's 'status' field was set to a value not in the SCHEDULE_STATUSES allowlist. Like signalType, status is only runtime-validated (markdown schedules bypass TypeScript), so assertValidScheduleDefinition rejects unknown values at definition/build time to prevent a confusing failure in schedule storage or on the first fire. The error message enumerates all valid statuses.","triggerScenarios":"Calling defineSchedule with status set to a misspelled or unsupported value (e.g. 'enabled'/'running' when the allowlist expects 'active'/'paused'-style values); a markdown/file-based schedule with an invalid status passed through resolveSchedules; a version change where the status enum was renamed.","commonSituations":"Guessing status names instead of checking the type/docs; hand-editing markdown schedules; copy-pasting a status string from another scheduling system (e.g. 'DISABLED' with wrong casing); migrating schedules between Mastra versions with renamed statuses.","solutions":["Set status to one of the values listed in the error message (the SCHEDULE_STATUSES allowlist).","Remove the status field entirely — it is optional and defaults apply.","Fix casing/spelling exactly against the allowlist values.","After a version upgrade, re-check any schedules that set status explicitly against the current enum."],"exampleFix":"// before\ndefineSchedule({ cron: '0 9 * * *', prompt: 'Run', status: 'enabled' });\n// after\ndefineSchedule({ cron: '0 9 * * *', prompt: 'Run', status: 'active' }); // use a value from SCHEDULE_STATUSES","handlingStrategy":"validation","validationCode":"import { SCHEDULE_STATUSES } from '@mastra/core/schedules';\nif (mySchedule.status !== undefined && !SCHEDULE_STATUSES.includes(mySchedule.status)) {\n  throw new Error(`status must be one of: ${SCHEDULE_STATUSES.join(', ')}`);\n}","typeGuard":"function isValidScheduleStatus(v: unknown): v is (typeof SCHEDULE_STATUSES)[number] {\n  return SCHEDULE_STATUSES.includes(v as any);\n}","tryCatchPattern":"try {\n  const schedule = defineSchedule(def);\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'SCHEDULES_INVALID_STATUS') {\n    // map the stored status to an allowed value or drop the field\n  } else throw e;\n}","preventionTips":["Import SCHEDULE_STATUSES and use its members rather than literal strings.","Omit status when the default behavior is acceptable.","Validate markdown-defined schedules through resolveSchedules/assertValidScheduleDefinition in CI.","Watch for renamed status values in changelogs when upgrading Mastra."],"tags":["schedules","enum","validation","user-error"],"backgroundTag":"invalid-enum-value","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}