{"record":{"id":"8586dc8bdf12048e","repo":"usestrix/strix","slug":"source-is-not-an-existing-file","errorCode":null,"errorMessage":"'{source}' is not an existing file","messagePattern":"'(.+?)' is not an existing file","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/interface/utils.py","lineNumber":1729,"sourceCode":"        raise ValueError(f\"'{spec}' has a control character in its destination path\")\n    return candidate\n\n\ndef resolve_workspace_files(specs: list[str] | None) -> list[dict[str, str]]:\n    \"\"\"Validate ``PATH[:DEST]`` specs into source/destination pairs.\n\n    Each spec names a readable host file. ``DEST`` is the path inside\n    ``/workspace``; it defaults to the file name. Raises ``ValueError`` with a\n    user-facing message when a spec is unusable.\n    \"\"\"\n    resolved: list[dict[str, str]] = []\n    seen: dict[str, str] = {}\n    for spec in specs or []:\n        raw, sep, dest = spec.rpartition(\":\")\n        source_text = raw if sep and dest.strip() else spec\n        source = Path(source_text.strip()).expanduser()\n        if not source.is_file():\n            raise ValueError(f\"'{source}' is not an existing file\")\n        try:\n            with source.open(\"rb\"):\n                pass\n        except OSError as error:\n            raise ValueError(f\"Cannot read '{source}': {error}\") from error\n        workspace_rel = _workspace_file_dest(spec, source)\n        if workspace_rel in seen:\n            raise ValueError(\n                f\"Two workspace files target /workspace/{workspace_rel}: \"\n                f\"'{seen[workspace_rel]}' and '{source}'\"\n            )\n        seen[workspace_rel] = str(source)\n        resolved.append(\n            {\n                \"source_path\": str(source.resolve()),\n                \"workspace_path\": f\"/workspace/{workspace_rel}\",\n            }\n        )","sourceCodeStart":1711,"sourceCodeEnd":1747,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/utils.py#L1711-L1747","documentation":"Raised by resolve_workspace_files() when the SOURCE half of a --workspace-file spec does not point to an existing regular file on the host. Only single readable host files can be injected; directories, missing paths, and special files are rejected before session bring-up.","triggerScenarios":"Passing --workspace-file ./missing.txt, pointing at a directory (--workspace-file ./configs), or a path with a typo. Path.expanduser() is applied, so '~/notes.txt' works but '~otheruser/x' fails if unreadable. The is_file() check runs before any container starts, so this fails fast at CLI argument resolution.","commonSituations":"Relative path given from a different working directory than expected; file created by an earlier pipeline step that was skipped or failed; spec built from a variable that is empty, making source_text resolve to '.' (a directory).","solutions":["Verify the path exists and is a file before invoking strix: python -c \"import sys,pathlib; sys.exit(0 if pathlib.Path(sys.argv[1]).expanduser().is_file() else 1)\" YOURFILE","Use an absolute path for the source to avoid cwd ambiguity: --workspace-file /home/me/notes.txt:notes.txt","If the file is generated by an earlier step, add existence checks to that step or make the step fail loudly before strix runs"],"exampleFix":"# before\nstrix --workspace-file ./out/report.json:report.json -t ./   # out/ not created yet\n# after\nmkdir -p out && ./generate_report.py && strix --workspace-file \"$(pwd)/out/report.json\":report.json -t ./","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef existing_file_specs(specs: list[str]) -> list[str]:\n    ok = []\n    for spec in specs:\n        src = spec.rpartition(\":\")[0] or spec\n        p = Path(src.strip()).expanduser()\n        if not p.is_file():\n            raise FileNotFoundError(f\"missing workspace file source: {p}\")\n        ok.append(spec)\n    return ok","typeGuard":null,"tryCatchPattern":"try:\n    resolve_workspace_files(specs)\nexcept ValueError as e:\n    if 'is not an existing file' in str(e):\n        prompt_user_for_correct_path()\n    else:\n        raise","preventionTips":["Pre-check every source with Path(...).expanduser().is_file() before launching strix","Use absolute source paths to avoid cwd dependence","Fail loudly in generating steps so downstream specs can trust files exist"],"tags":["strix","cli","file-io","validation","workspace-files"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}