{"record":{"id":"761e6f50ed00bc12","repo":"mastra-ai/mastra","slug":"no-exports-are-available-from-the-top-level-mast","errorCode":null,"errorMessage":"No exports are available from the top-level \"@mastra/server\" package.\n\nUse specific subpath imports instead, e.g. \"@mastra/server/handlers\" or \"@mastra/server/handlers/tools\".","messagePattern":"No exports are available from the top-level \"@mastra/server\" package\\.\n\nUse specific subpath imports instead, e\\.g\\. \"@mastra/server/handlers\" or \"@mastra/server/handlers/tools\"\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/server/src/index.ts","lineNumber":1,"sourceCode":"throw new Error(`No exports are available from the top-level \"@mastra/server\" package.\n\nUse specific subpath imports instead, e.g. \"@mastra/server/handlers\" or \"@mastra/server/handlers/tools\".`);\n","sourceCodeStart":1,"sourceCodeEnd":4,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/index.ts#L1-L4","documentation":"The @mastra/server package intentionally exports nothing from its root entry point. Importing it at the top level executes this module, which immediately throws, and the error explains that consumers must use documented subpath exports such as '@mastra/server/handlers' or '@mastra/server/handlers/tools'. This guards the package's public API surface so internal modules are only reachable through stable subpaths.","triggerScenarios":"Any import like import ... from '@mastra/server' or require('@mastra/server') — e.g. an IDE auto-import defaulting to the package root, or copying an old import path.","commonSituations":"IDE auto-completion picking the package root instead of a subpath; migrating code written before subpath-only exports were enforced; docs/examples referencing the root import.","solutions":["Change the import to the specific subpath you need, e.g. '@mastra/server/handlers' or '@mastra/server/handlers/tools'.","Check the package.json 'exports' field of @mastra/server for the full list of allowed subpaths.","Fix IDE auto-imports by choosing the subpath entry or configuring import resolution to respect package exports."],"exampleFix":"// before\nimport { createHandler } from '@mastra/server';\n// after\nimport { createHandler } from '@mastra/server/handlers';","handlingStrategy":"validation","validationCode":"// lint rule / manual check\n// Bad: import x from '@mastra/server'\n// Verify imports against package.json exports:\n// node -e \"console.log(Object.keys(require('@mastra/server/package.json').exports))\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always import @mastra/server via its documented subpaths (e.g. /handlers).","Configure ESLint no-restricted-imports to ban the bare '@mastra/server' import.","Fix IDE auto-imports by preferring subpath entries."],"tags":["imports","module-resolution","package-exports"],"backgroundTag":"forbidden-root-import","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}