Any reason why I cannot create a base configuration and instanciate mastra with it?

This works fine
export const mastra = new Mastra({
workflows: { weatherWorkflow, vetPetPlanWorkflow },
agents: { vet, productRecommendationsAgent, petProductSuitabilityAgent },
export const mastra = new Mastra({
workflows: { weatherWorkflow, vetPetPlanWorkflow },
agents: { vet, productRecommendationsAgent, petProductSuitabilityAgent },
But this fails when running mastra dev
import { mastraBaseConfig } from './config';


export const mastra = new Mastra({
...mastraBaseConfig,
import { mastraBaseConfig } from './config';


export const mastra = new Mastra({
...mastraBaseConfig,
config module just has this
export const mastraBaseConfig = {
workflows: { weatherWorkflow, vetPetPlanWorkflow },
agents: { vet, productRecommendationsAgent, petProductSuitabilityAgent },
vectors: {
internal: new PgVector(connectionConfig)
},
};
export const mastraBaseConfig = {
workflows: { weatherWorkflow, vetPetPlanWorkflow },
agents: { vet, productRecommendationsAgent, petProductSuitabilityAgent },
vectors: {
internal: new PgVector(connectionConfig)
},
};
Exception
• Packages in scope: mastra
• Running dev in 1 packages
• Remote caching disabled
mastra:dev: cache bypass, force executing 53092310254a8885
mastra:dev:
mastra:dev: > mastra@1.0.0 dev /Users/ricardochiriboga/Development/PawsforLife/or
pheus/apps/mastra
mastra:dev: > mastra dev
mastra:dev:
mastra:dev: ERROR [2025-12-01 21:50:41.257 +1100] (Mastra CLI): /Users/ricardochi
riboga/Development/PawsforLife/orpheus/apps/mastra/src/mastra/index.ts: Cannot re
ad properties of undefined (reading 'name')
• Packages in scope: mastra
• Running dev in 1 packages
• Remote caching disabled
mastra:dev: cache bypass, force executing 53092310254a8885
mastra:dev:
mastra:dev: > mastra@1.0.0 dev /Users/ricardochiriboga/Development/PawsforLife/or
pheus/apps/mastra
mastra:dev: > mastra dev
mastra:dev:
mastra:dev: ERROR [2025-12-01 21:50:41.257 +1100] (Mastra CLI): /Users/ricardochi
riboga/Development/PawsforLife/orpheus/apps/mastra/src/mastra/index.ts: Cannot re
ad properties of undefined (reading 'name')
5 Replies
Mastra Triager
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10700 🔍 If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly. 🙏 Thank you for helping us improve Mastra!
Abhi Aiyer
Abhi Aiyer6d ago
Hi @rachirib i reproduce! When you spread it into an object it looses context new Mastra(confg) works but the spread doesn't
Abhi Aiyer
Abhi Aiyer6d ago
GitHub
fix: handle undefined values when spreading config in Mastra constr...
When config is spread ({ ...config }), getters or non-enumerable properties can result in undefined values. Previously this would throw cryptic errors like "Cannot read property 'n...
Abhi Aiyer
Abhi Aiyer6d ago
GitHub
fix: handle undefined values when spreading config in Mastra constr...
When config is spread ({ ...config }), getters or non-enumerable properties can result in undefined values. Previously this would throw cryptic errors like "Cannot read property 'n...
rachirib
rachiribOP6d ago
Thank you ! That's so quick!

Did you find this page helpful?