mastra-ai/mastra · error · Error

`validateCron` is not available in this version of @mastra/c

Error message

`validateCron` is not available in this version of @mastra/core. Schedules require @mastra/core >= 1.32.0.

What it means

Same shim pattern as computeNextFireAt: validateCron is re-exported from @mastra/core and replaced with a throwing stub when the installed core (< 1.32.0) does not export it. Creating or validating a schedule then fails with this error.

Source

Thrown at packages/server/src/server/handlers/schedules-workflows-shim.ts:38

import * as coreWorkflows from '@mastra/core/workflows';

const exportedNext = (coreWorkflows as Record<string, unknown>).computeNextFireAt;
const exportedValidate = (coreWorkflows as Record<string, unknown>).validateCron;

export const computeNextFireAt: any =
  exportedNext ??
  (() => {
    throw new Error(
      '`computeNextFireAt` is not available in this version of @mastra/core. ' +
        'Schedules require @mastra/core >= 1.32.0.',
    );
  });

export const validateCron: any =
  exportedValidate ??
  (() => {
    throw new Error(
      '`validateCron` is not available in this version of @mastra/core. ' + 'Schedules require @mastra/core >= 1.32.0.',
    );
  });

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade @mastra/core to >= 1.32.0.
  2. Run a clean install (rm lockfile entries / pnpm install) to remove stale core copies.
  3. Check for duplicate @mastra/core versions in the tree (pnpm why @mastra/core) and dedupe.

Example fix

// before
pnpm add @mastra/server@latest  # core left at 1.31.0
// after
pnpm add @mastra/server@latest @mastra/core@latest
Defensive patterns

Strategy: fallback

Validate before calling

import * as core from '@mastra/core';
if (typeof (core as any).validateCron !== 'function') {
  throw new Error('@mastra/core >= 1.32.0 is required for cron validation');
}

Try / catch

try {
  await client.createSchedule({ workflowId, cron });
} catch (e) {
  if (/validateCron/.test(String(e?.message))) {
    throw new Error('Upgrade @mastra/core to >= 1.32.0 to use schedules');
  }
  throw e;
}

Prevention

When it happens

Trigger: POST to create/update a schedule (which validates body.cron) while @mastra/core < 1.32.0 is installed, or the export is absent in the resolved version.

Common situations: Outdated or mismatched @mastra/core in the workspace; server upgraded to schedules support without upgrading core; stale node_modules after a version bump.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/2b578cc3ffc1f94e. Report an issue: GitHub.