mastra-ai/mastra · error · Error

`computeNextFireAt` is not available in this version of @mas

Error message

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

What it means

schedules-workflows-shim re-exports computeNextFireAt from @mastra/core; if the installed core version does not export it (< 1.32.0), the shim substitutes a throwing stub, so any schedule computation (e.g. listing schedules, computing next run) crashes with this message.

Source

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

 * A namespace import tolerates missing names. We expose the real function
 * when available and fall back to a function that throws a clear error
 * otherwise — schedules require new-core support anyway, so loud failure at
 * the call site is far better than silent corruption.
 *
 * Typed as `any` on purpose (see ./observability-storage-schemas.ts for
 * the same rationale): keeps the emitted `.d.ts` free of names that don't
 * exist in older cores.
 */

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 (pnpm --filter ... @mastra/core@latest or update the lockfile).
  2. Align all @mastra/* package versions so server and core are from the same minor series.
  3. Verify after install that `import('@mastra/core').computeNextFireAt` exists (no undefined export).

Example fix

// before (package.json)
"@mastra/core": "1.30.2"
// after
"@mastra/core": "^1.32.0"
Defensive patterns

Strategy: fallback

Validate before calling

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

Try / catch

try {
  const next = await client.computeNextFireAt(cron);
} catch (e) {
  if (/computeNextFireAt/.test(String(e?.message))) {
    // upgrade core then retry
    throw new Error('Upgrade @mastra/core to >= 1.32.0 to use schedules');
  }
  throw e;
}

Prevention

When it happens

Trigger: Any schedules API call that needs to compute a cron's next fire time while @mastra/core resolves to a version older than 1.32.0, or a version where the export was renamed/removed.

Common situations: Lockfile pinned to an older core; monorepo dependency mismatch where @mastra/server is newer than @mastra/core; partial upgrade of @mastra/* packages.

Related errors


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