{"record":{"id":"2ba147e60e35853f","repo":"mastra-ai/mastra","slug":"no-filesystem","errorCode":"NO_FILESYSTEM","errorMessage":"Workspace does not have a filesystem configured","messagePattern":"Workspace does not have a filesystem configured","errorType":"error_code","errorClass":"FilesystemNotAvailableError","httpStatus":null,"severity":"error","filePath":"packages/core/src/workspace/tools/helpers.ts","lineNumber":53,"sourceCode":" */\nexport function requireWorkspace(context: ToolExecutionContext): Workspace {\n  if (!context?.workspace) {\n    throw new WorkspaceNotAvailableError();\n  }\n  return context.workspace;\n}\n\n/**\n * Extract filesystem from workspace in tool execution context.\n * Throws if workspace or filesystem is not available.\n */\nexport function requireFilesystem(context: ToolExecutionContext): {\n  workspace: Workspace;\n  filesystem: WorkspaceFilesystem;\n} {\n  const workspace = requireWorkspace(context);\n  if (!workspace.filesystem) {\n    throw new FilesystemNotAvailableError();\n  }\n  return { workspace, filesystem: workspace.filesystem };\n}\n\n/**\n * Extract sandbox from workspace in tool execution context.\n * Throws if workspace or sandbox is not available.\n */\nexport function requireSandbox(context: ToolExecutionContext): {\n  workspace: Workspace;\n  sandbox: WorkspaceSandbox;\n} {\n  const workspace = requireWorkspace(context);\n  if (!workspace.sandbox) {\n    throw new SandboxNotAvailableError();\n  }\n  return { workspace, sandbox: workspace.sandbox };\n}","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workspace/tools/helpers.ts#L35-L71","documentation":"Thrown by requireFilesystem when the workspace exists but has no `filesystem` configured. File tools need a filesystem provider to read/write; a workspace with only a sandbox (or neither) cannot serve them. FilesystemNotAvailableError carries code NO_FILESYSTEM.","triggerScenarios":"Invoking file tools (read/write/edit/delete/list) on a workspace constructed without a filesystem, e.g. `new Workspace({ sandbox })` only.","commonSituations":"Configuring a workspace for shell/computer use only and later adding file tools; removing the filesystem option during refactors; assuming a sandbox implies filesystem access.","solutions":["Add a filesystem provider to the workspace: `new Workspace({ filesystem: createFilesystem({ root }) })`","Only register/expose file tools when `workspace.filesystem` is set","Check `workspace.filesystem` before executing file operations in custom code","Catch NO_FILESYSTEM and fall back to sandbox shell commands if appropriate"],"exampleFix":"// before\nnew Workspace({ sandbox })\n// after\nnew Workspace({ sandbox, filesystem: createFilesystem({ root: process.cwd() }) })","handlingStrategy":"type-guard","validationCode":"if (!workspace.filesystem) {\n  throw new Error('File tools require a workspace filesystem');\n}","typeGuard":"function hasFilesystem(w: Workspace): w is Workspace & { filesystem: WorkspaceFilesystem } {\n  return !!w.filesystem;\n}","tryCatchPattern":"try {\n  return await fileTool.execute(ctx);\n} catch (e: any) {\n  if (e?.code === 'NO_FILESYSTEM' || /filesystem configured/i.test(e?.message ?? '')) {\n    return { error: 'Add a filesystem to the workspace to use file tools.' };\n  }\n  throw e;\n}","preventionTips":["Configure `filesystem` whenever file tools are registered","Derive tool registration from workspace capabilities","Don't assume sandbox implies filesystem","Integration-test tool execution against the real workspace config"],"tags":["configuration","workspace","filesystem","missing-config"],"backgroundTag":"missing-workspace-config","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}