{"record":{"id":"fd1038ccf6a1f8cf","repo":"mastra-ai/mastra","slug":"unsupported-schedule-target-type-schedule-targ","errorCode":null,"errorMessage":"Unsupported schedule target type: ${(schedule.target as { type: string }).type}","messagePattern":"Unsupported schedule target type: (.+?)\\)\\.type\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/workflows/scheduler/scheduler.ts","lineNumber":499,"sourceCode":"          localOnly ? { localOnly: true } : undefined,\n        );\n        return;\n      }\n      case 'agent': {\n        await this.#pubsub.publish(TOPIC_AGENT_SCHEDULES, {\n          type: 'agent-schedule.fire',\n          runId: claimId,\n          data: {\n            scheduleId: schedule.id,\n            claimId,\n            scheduledFireAt: schedule.nextFireAt,\n            target: schedule.target,\n          },\n        });\n        return;\n      }\n      default: {\n        throw new Error(`Unsupported schedule target type: ${(schedule.target as { type: string }).type}`);\n      }\n    }\n  }\n}\n\n/**\n * @deprecated Renamed to {@link Scheduler}. The scheduler now drives both\n * workflow and agent schedules, so the `Workflow`-prefixed name is no longer\n * accurate. This alias will be removed in a future major release.\n */\nexport const WorkflowScheduler = Scheduler;\n\n/**\n * @deprecated Renamed to {@link Scheduler}. This alias will be removed in a\n * future major release.\n */\nexport type WorkflowScheduler = Scheduler;\n","sourceCodeStart":481,"sourceCodeEnd":517,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workflows/scheduler/scheduler.ts#L481-L517","documentation":"#publishTargetStart throws when a schedule's target object has a `type` the scheduler does not recognize in its switch statement. It is an exhaustive-dispatch guard: only registered target types (e.g. workflow/step/event) are supported.","triggerScenarios":"Creating or persisting a schedule whose target.type is misspelled ('workflows' vs 'workflow'), added by a newer/older version, or comes from deserialized state written by a different schema version.","commonSituations":"Hand-edited persisted schedule records; version skew between the writer of the schedule and the scheduler process; custom target types that were never registered.","solutions":["Print/inspect schedule.target.type and set it to one of the scheduler's supported target types.","Fix the typo in the target type discriminator.","Re-create the schedule through the scheduler's public API so it validates the target.","Migrate or delete stale persisted schedules written by incompatible versions."],"exampleFix":"// before\nscheduler.createSchedule({ target: { type: 'workflows', id: 'myFlow' } });\n// after\nscheduler.createSchedule({ target: { type: 'workflow', id: 'myFlow' } });","handlingStrategy":"validation","validationCode":"const SUPPORTED_TARGET_TYPES = ['workflow','step','event']; // per scheduler docs\nfunction assertTarget(t: { type: string }) {\n  if (!SUPPORTED_TARGET_TYPES.includes(t.type)) throw new Error(`Unsupported schedule target type: ${t.type}`);\n}","typeGuard":"function isSupportedTarget(t: unknown): t is { type: string; id: string } {\n  const types = ['workflow','step','event'];\n  return !!t && typeof t === 'object' && 'type' in t && types.includes((t as any).type);\n}","tryCatchPattern":"try {\n  scheduler.createSchedule({ target });\n} catch (e) {\n  if ((e as Error).message.startsWith('Unsupported schedule target type')) {\n    console.error(`Target type '${target.type}' unsupported; allowed: workflow, step, event`);\n  } else throw e;\n}","preventionTips":["Create schedules only through the scheduler's public API, which validates targets","Use a discriminated-union TS type for schedule targets","Check persisted schedule records after upgrading library versions","Avoid hand-editing stored schedule state"],"tags":["workflows","scheduler","unsupported-target","dispatch"],"backgroundTag":"unsupported-target-type","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}