{"record":{"id":"4c27fc45e8931139","repo":"langchain-ai/deepagents","slug":"could-not-resolve-label-path-raw-path-r-exc","errorCode":null,"errorMessage":"Could not resolve {label} path {raw_path!r}: {exc}. Ensure the path exists and is accessible.","messagePattern":"Could not resolve (.+?) path (.+?): (.+?)\\. Ensure the path exists and is accessible\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/_server_config.py","lineNumber":834,"sourceCode":"\n    Returns:\n        Absolute path string, or `None` when *raw_path* is `None` or empty.\n\n    Raises:\n        ValueError: If the path cannot be resolved.\n    \"\"\"\n    if not raw_path:\n        return None\n    try:\n        if project_context is not None:\n            return str(project_context.resolve_user_path(raw_path))\n        return str(Path(raw_path).expanduser().resolve())\n    except OSError as exc:\n        msg = (\n            f\"Could not resolve {label} path {raw_path!r}: {exc}. \"\n            \"Ensure the path exists and is accessible.\"\n        )\n        raise ValueError(msg) from exc\n","sourceCodeStart":816,"sourceCodeEnd":835,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/_server_config.py#L816-L835","documentation":"_normalize_path calls Path(raw_path).expanduser().resolve(), and if the OS raises OSError (e.g. permission denied, I/O error, too many symlinks, or an unresolvable path on some platforms) the error is re-raised as a ValueError with a clear, label-aware message pointing at which path failed.","triggerScenarios":"Passing a path via CLI args (from_cli_args -> _normalize_path) for which expanduser().resolve() hits an OSError — e.g. a directory with no execute permission, a broken symlink chain, or a path on an unreadable/unmounted filesystem.","commonSituations":"Running the CLI against a mounted network share that is offline; using '~' with an unset HOME causing issues; chmod'ing down a parent directory; mistyped path with unusual characters on certain filesystems.","solutions":["Verify the path exists and is accessible: run `ls -ld <path>` (and each parent) as the same user the CLI runs as.","Fix permissions or mount state for the failing directory, or correct the typo in the path.","If the path may legitimately be absent, check `Path(p).exists() and os.access(p, os.R_OK)` before invoking the CLI and supply a valid path.","Set HOME explicitly if '~' expansion is involved and HOME is wrong or unset."],"exampleFix":"# before\ndeepagents-code --workdir /mnt/share/project   # share unmounted\n# after\nmount /mnt/share  # or point --workdir at an accessible local path","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\ndef ensure_accessible(raw: str) -> str:\n    p = Path(raw).expanduser()\n    if not p.exists():\n        raise FileNotFoundError(f\"path does not exist: {p}\")\n    if not os.access(p, os.R_OK | os.X_OK):\n        raise PermissionError(f\"path not accessible: {p}\")\n    return str(p.resolve())","typeGuard":null,"tryCatchPattern":"try:\n    agent = build_from_cli_args(args)\nexcept ValueError as exc:\n    if \"Could not resolve\" in str(exc):\n        print(f\"Bad path: {exc}\"); sys.exit(2)\n    raise","preventionTips":["Check existence and permissions of all supplied paths before invoking the CLI.","Avoid pointing at network mounts or paths under directories you do not own without testing access first.","Set HOME correctly when relying on '~' expansion.","Quote and avoid exotic characters/overlong paths on constrained filesystems."],"tags":["filesystem","cli","config"],"backgroundTag":"path-resolution-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}