Skip to content

mastra dev generating malformed provider-registry.json on every execution #10434

@daneatmastra

Description

@daneatmastra

This issue was created from Discord post 1442313801625239644:

Open in Discord

Hi! I’ve got an error that has started happening consistently on my machine but not on any of my coworkers, and I’m looking for some guidance from someone who works with the Mastra source - I think it’s likely an easy fix for someone familiar with the codebase. I'm not sure if I can provide any reproduction given how my coworkers don't have this issue with the same codebase.

  • Mastra's auto-generated provider-registry.json becomes malformed on my machine every time for unknown reasons
  • This could be bypassed if I could turn off dynamic loading but there does not appear to be a way to do that without me editing the code directly.
  • This means mastra dev doesn't work on my machine at all without some very awkward workarounds.

I'm still investigating why the JSON file is malformed on my machine, but I could do with some
advice on this.

When I run mastra dev but not with build + start:

Error: Failed to load provider registry with dynamic loading. Make sure provider-registry.json is generated by running: npm run generate:providers

Tried paths:
[...]/packages/mastra/node_modules/@mastra/core/dist/provider-registry.json: Unexpected non-whitespace character after JSON at position 77837 (line 2483 column 2)
[...]
    at loadRegistry (file://[...]/packages/mastra/node_modules/@mastra/core/dist/chunk-II37LKES.js:2234:9)
    at _GatewayRegistry.getProviders (file://[...]/packages/mastra/node_modules/@mastra/core/dist/chunk-II37LKES.js:2459:18)
    at Object.ownKeys (file://[...]/packages/mastra/node_modules/@mastra/core/dist/chunk-II37LKES.js:2249:32)
    at Function.entries (<anonymous>)
    at getStaticProvidersByGateway (file://[...]/packages/mastra/node_modules/@mastra/core/dist/chunk-II37LKES.js:2497:36)
[...]]

Metadata

Metadata

Labels

Mastra ServerIssues related to the Mastra Server or its handlersdiscordFor issues created from Discord discussions.p: urgentUrgent prioritytrio-tb

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions