mastra-ai/mastra · error

MISSING_MASTRA_CORE

MISSING_MASTRA_CORE

Error message

MISSING_MASTRA_CORE

What it means

A lint rule that verifies @mastra/core is present among the project's installed Mastra packages. @mastra/core is the required runtime dependency; without it, Mastra features cannot work. The rule reports a project-scoped lint issue (code MISSING_MASTRA_CORE).

Source

Thrown at packages/cli/src/commands/lint/rules/mastraCoreRule.ts:11

import type { LintContext, LintIssue, LintRule } from './types.js';

export const mastraCoreRule: LintRule = {
  name: 'mastra-core',
  description: 'Checks if @mastra/core is installed',
  async run(context: LintContext): Promise<LintIssue[]> {
    const hasCore = context.mastraPackages.some(pkg => pkg.name === '@mastra/core');
    if (!hasCore) {
      return [
        {
          code: 'MISSING_MASTRA_CORE',
          severity: 'error',
          scope: 'project',
          message: '@mastra/core is not installed. This package is required for Mastra to work properly.',
          fix: 'Install @mastra/core: pnpm add @mastra/core',
        },
      ];
    }

    return [];
  },
};

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Install @mastra/core: `pnpm add @mastra/core` (or npm/yarn equivalent).
  2. If it's in package.json but not installed, run `pnpm install` to fix a broken install.
  3. Check that it wasn't marked as a devDependency/removed by dependency cleanup tooling.
  4. Re-run `mastra lint` to confirm the issue is resolved.

Example fix

// before (package.json)
"dependencies": { "@mastra/client-js": "^1.0.0" }
// after
"dependencies": { "@mastra/client-js": "^1.0.0", "@mastra/core": "^1.0.0" }
Defensive patterns

Strategy: validation

Validate before calling

const deps = { ...pkg.dependencies, ...pkg.devDependencies };
if (!deps['@mastra/core']) {
  console.warn('Install @mastra/core before running `mastra lint`');
}

Prevention

When it happens

Trigger: Running `mastra lint` in a project whose dependency list (node_modules / lockfile scan) contains Mastra packages but not '@mastra/core'.

Common situations: Installing only plugin packages (e.g. @mastra/client-js or a framework integration) without the core package, partially failed installs, or accidentally removing the dependency during cleanup.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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