{"record":{"id":"e373897ae3828f34","repo":"mastra-ai/mastra","slug":"invalid-config","errorCode":"INVALID_CONFIG","errorMessage":"Cannot use both \"filesystem\" and \"mounts\"","messagePattern":"Cannot use both \"filesystem\" and \"mounts\"","errorType":"error_code","errorClass":"WorkspaceError","httpStatus":null,"severity":"error","filePath":"packages/core/src/workspace/workspace.ts","lineNumber":613,"sourceCode":"    this.name = config.name ?? `workspace-${this.id.slice(0, 8)}`;\n    this.createdAt = new Date();\n    this.lastAccessedAt = new Date();\n\n    this._config = config;\n\n    if (typeof config.sandbox === 'function') {\n      this._sandboxResolver = config.sandbox as WorkspaceSandboxResolver;\n    } else {\n      this._sandbox = config.sandbox;\n    }\n    this._sandboxCacheKey = config.sandboxCacheKey;\n    this._dynamicSandboxInstructions = config.instructions?.dynamicSandbox ?? 'placeholder';\n\n    // Setup mounts - creates CompositeFilesystem and informs sandbox\n    if (config.mounts && Object.keys(config.mounts).length > 0) {\n      // Validate: can't use both filesystem and mounts\n      if (config.filesystem) {\n        throw new WorkspaceError('Cannot use both \"filesystem\" and \"mounts\"', 'INVALID_CONFIG');\n      }\n      if (this._sandboxResolver) {\n        throw new WorkspaceError(\n          'Cannot use \"mounts\" with a dynamic sandbox resolver. ' +\n            'Mounts are attached to a sandbox instance at construction time. ' +\n            'Either pass a static sandbox instance, or have your resolver return a sandbox with its mounts already configured.',\n          'INVALID_CONFIG',\n        );\n      }\n\n      // Warn: contained: false is incompatible with mounts\n      for (const [mountPath, fs] of Object.entries(config.mounts)) {\n        if (fs instanceof LocalFilesystem && !fs.contained) {\n          console.warn(\n            `[Workspace] LocalFilesystem at mount \"${mountPath}\" has contained: false, which is incompatible with mounts. ` +\n              `CompositeFilesystem strips mount prefixes and produces absolute paths (e.g. \"/file.txt\"), ` +\n              `which a non-contained LocalFilesystem interprets as real host paths instead of paths ` +\n              `relative to basePath. Use contained: true (default) or allowedPaths for specific exceptions.`,","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workspace/workspace.ts#L595-L631","documentation":"A Workspace can obtain its filesystem either from a single `filesystem` config or from `mounts` (which build a CompositeFilesystem), but not both — the two sources are mutually exclusive by design. The constructor validates this and throws `WorkspaceError` with code `INVALID_CONFIG` when both are supplied and mounts is non-empty.","triggerScenarios":"`new Workspace({ filesystem: someFs, mounts: { '/data': otherFs } })` — any config where `config.filesystem` is set AND `config.mounts` has at least one key.","commonSituations":"Merging default config objects where a base config sets `filesystem` and an override adds `mounts`; copying example code that uses mounts into an existing config that already sets `filesystem`; incremental migration from single-fs to mounts config.","solutions":["Remove the `filesystem` property and keep `mounts` (mounting the primary filesystem at '/' if a root fs is needed)","Or remove `mounts` and keep `filesystem` if a single filesystem suffices","If merging configs, ensure only one of the two keys survives the merge"],"exampleFix":"// before\nnew Workspace({\n  filesystem: new LocalFilesystem('/repo'),\n  mounts: { '/data': new LocalFilesystem('/data') },\n})\n\n// after\nnew Workspace({\n  mounts: {\n    '/': new LocalFilesystem('/repo'),\n    '/data': new LocalFilesystem('/data'),\n  },\n})","handlingStrategy":"validation","validationCode":"if (cfg.filesystem && cfg.mounts && Object.keys(cfg.mounts).length > 0) {\n  throw new Error('Workspace config cannot include both `filesystem` and non-empty `mounts`.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const ws = new Workspace(cfg);\n} catch (err) {\n  if (err?.code === 'INVALID_CONFIG') {\n    console.error('Workspace config error:', err.message);\n    throw err;\n  }\n  throw err;\n}","preventionTips":["Pick one filesystem source convention (either filesystem or mounts) per project and document it","When merging/overriding config objects, explicitly delete the excluded key","Add a schema validation step on Workspace config before construction"],"tags":["configuration","invalid-config","workspace","mounts"],"backgroundTag":"invalid-config","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}