{"record":{"id":"76f77975741dfede","repo":"langchain-ai/deepagents","slug":"invalid-deepagents-home-str-root-r-exists-but","errorCode":null,"errorMessage":"Invalid DEEPAGENTS_HOME {str(root)!r}: exists but cannot be read. Check the permissions on it and on its parent directories.","messagePattern":"Invalid DEEPAGENTS_HOME (.+?): exists but cannot be read\\. Check the permissions on it and on its parent directories\\.","errorType":"exception","errorClass":"DeepAgentsHomeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/_paths.py","lineNumber":703,"sourceCode":"    cased spelling of `/` or of the home directory is rejected too.\n\n    The readability check runs first. `_same_directory` cannot compare a path\n    it may not read, so checking state first reports the permission problem\n    itself instead of the comparison that failed because of it.\n\n    Raises:\n        DeepAgentsHomeError: If the root is one of those cases.\n    \"\"\"\n    state = classify_path(root)\n    if state is PathState.UNREADABLE:\n        # Checked before the symlink branch too: `Path.is_symlink` swallows the\n        # `OSError` and reports `False` under EACCES, so an unreadable root\n        # would otherwise fall through every check and be accepted.\n        msg = (\n            f\"Invalid DEEPAGENTS_HOME {str(root)!r}: exists but cannot be read. \"\n            \"Check the permissions on it and on its parent directories.\"\n        )\n        raise DeepAgentsHomeError(msg)\n    if state is PathState.EXISTS and not root.is_dir():\n        msg = f\"Invalid DEEPAGENTS_HOME {str(root)!r}: exists but is not a directory.\"\n        raise DeepAgentsHomeError(msg)\n    if state is PathState.EXISTS and not os.access(root, os.R_OK | os.X_OK):\n        msg = (\n            f\"Invalid DEEPAGENTS_HOME {str(root)!r}: exists but cannot be read \"\n            \"or searched. Check the permissions on it and on its parent \"\n            \"directories.\"\n        )\n        raise DeepAgentsHomeError(msg)\n    # `root` is normalized-absolute, so `anchor` is always set.\n    if root.parent == root or _same_directory(root, Path(root.anchor)):\n        msg = (\n            f\"Invalid DEEPAGENTS_HOME {str(root)!r}: the filesystem root cannot \"\n            \"be a profile. Use a dedicated directory.\"\n        )\n        raise DeepAgentsHomeError(msg)\n    if launch_home is not None and _same_directory(root, launch_home):","sourceCodeStart":685,"sourceCodeEnd":721,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/_paths.py#L685-L721","documentation":"_reject_degenerate_root validates an existing DEEPAGENTS_HOME path: it must be readable and searchable (os.access R_OK|X_OK) to be usable as a profile root. An existing but unreadable path is rejected with DeepAgentsHomeError because the library would otherwise silently accept a root it cannot inspect, and the profile root is a trust boundary.","triggerScenarios":"DEEPAGENTS_HOME set to an existing path that the current user cannot read or search (missing r or x permission) while _resolve_profile_root runs its checks.","commonSituations":"Directory restored from a backup with root ownership; chmod 000 applied by mistake; container volume mounted with restrictive uid ownership.","solutions":["Restore access: chmod u+rx <path> (and fix ownership with chown if needed).","Fix parent-directory permissions so the path is traversable.","If the path is unusable, remove or rename it and set DEEPAGENTS_HOME to a fresh user-owned directory."],"exampleFix":"// before\ndrwx------ root root /opt/deepagents-home\n// after\nsudo chown $(whoami) /opt/deepagents-home && chmod u+rwx /opt/deepagents-home","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\nroot = Path(os.environ.get('DEEPAGENTS_HOME', ''))\nif root.exists() and not (os.access(root, os.R_OK | os.X_OK) and root.is_dir()):\n    raise SystemExit(f'DEEPAGENTS_HOME {root} must be a readable directory')","typeGuard":null,"tryCatchPattern":"try:\n    root = _resolve_profile_root()\nexcept DeepAgentsHomeError as exc:\n    if 'cannot be read' in str(exc):\n        raise SystemExit(f'Run: chmod u+rx {root} (and fix parents)') from exc\n    raise","preventionTips":["After restoring backups or mounting volumes, re-check ownership and mode.","Avoid chmod 000-style lockdowns on runtime state directories.","Prefer user-owned directories for DEEPAGENTS_HOME."],"tags":["permissions","filesystem","configuration"],"backgroundTag":"permission-denied","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}