{"record":{"id":"23108c6fc7b74dd3","repo":"langchain-ai/deepagents","slug":"notimplementederror-raised-by-abstract-glob-bac","errorCode":null,"errorMessage":"NotImplementedError raised by abstract `glob` (backend does not implement `glob`)","messagePattern":"NotImplementedError raised by abstract `glob` \\(backend does not implement `glob`\\)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/backends/protocol.py","lineNumber":653,"sourceCode":"            path: Optional base directory to search from.\n\n                If omitted, the backend chooses its default search root.\n\n                The pattern is applied relative to this path.\n\n        Returns:\n            `GlobResult` with matching files or error. Patterns the matcher\n            refuses -- brace expansion past its limit, or a `..` segment -- are\n            reported as `error` with `matches=None`, not raised.\n\n            `FileInfo.path` is always absolute. `_check_fs_permission` matches\n            `deny` rules against absolute patterns only, so a backend returning\n            a relative path silently bypasses every deny rule.\n\n        Raises:\n            NotImplementedError: If the backend does not implement `glob`.\n        \"\"\"\n        raise NotImplementedError\n\n    async def aglob(self, pattern: str, path: str | None = None) -> \"GlobResult\":\n        \"\"\"Async version of `glob`.\"\"\"\n        return await asyncio.to_thread(self.glob, pattern, path)\n\n    def write(\n        self,\n        file_path: str,\n        content: str,\n    ) -> WriteResult:\n        \"\"\"Write content to a file, creating it or overwriting it if it already exists.\n\n        Args:\n            file_path: Absolute path where the file should be written.\n\n                Must start with '/'.\n            content: String content to write to the file.\n","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/backends/protocol.py#L635-L671","documentation":"The base Backend class defines `glob` as an abstract method raising NotImplementedError; subclasses must implement pattern-based file matching. The docstring warns backends must return ABSOLUTE paths — deny rules are only evaluated against absolute patterns, so a relative path would silently bypass them. Hitting NotImplementedError means the backend in use never implemented glob.","triggerScenarios":"Agent issues a glob tool call (or middleware calls backend.glob(pattern, path)) on a partial backend subclass; instantiating Backend directly and calling glob.","commonSituations":"Minimal custom backends that only cover read/write; virtual or remote backends without pattern-matching support; tests using stubs when the model calls the glob tool.","solutions":["Implement `glob(self, pattern, path=None) -> GlobResult` in your backend, returning absolute paths so permission/deny rules apply.","If globbing is unsupported by the storage system, enumerate candidates yourself and match with fnmatch, returning a valid GlobResult.","Alternatively use a backend with glob support, or disable the glob tool for agents using this backend."],"exampleFix":"// before\nclass DbBackend(Backend):\n    def read(self, file_path, offset=0, limit=2000): ...\n// after\nimport fnmatch\nclass DbBackend(Backend):\n    def read(self, file_path, offset=0, limit=2000): ...\n    def glob(self, pattern, path=None):\n        matches = [f'/{k}' for k in self.store if fnmatch.fnmatch(f'/{k}', pattern)]\n        return GlobResult(files=matches)","handlingStrategy":"try-catch","validationCode":"if type(backend).glob is Backend.glob:\n    raise RuntimeError('backend does not implement glob; disable the glob tool or switch backends')","typeGuard":"def supports_glob(backend) -> bool:\n    return type(backend).glob is not Backend.glob","tryCatchPattern":"try:\n    result = backend.glob(pattern)\nexcept NotImplementedError:\n    return GlobResult(files=[], error='glob not supported by this backend')","preventionTips":["When implementing glob, return ABSOLUTE paths — relative paths silently bypass deny rules.","Fallback implementation: enumerate keys and filter with fnmatch when the store lacks globbing.","Add glob to your backend capability test matrix."],"tags":["not-implemented","abstract-method","backend-protocol"],"backgroundTag":"not-implemented","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}