{"id":"54109bd34aeab893","repo":"pypa/pip","slug":"error-parsing-path-e","errorCode":null,"errorMessage":"Error parsing {path}: {e}","messagePattern":"Error parsing (.+?): (.+?)","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/req/req_dependency_group.py","lineNumber":84,"sourceCode":"                f\"[dependency-groups] data was invalid in {path}: {'; '.join(messages)}\"\n            ) from eg\n\n    return resolvers\n\n\ndef _load_pyproject(path: str) -> dict[str, Any]:\n    \"\"\"\n    This helper loads a pyproject.toml as TOML.\n\n    It raises an InstallationError if the operation fails.\n    \"\"\"\n    try:\n        with open(path, \"rb\") as fp:\n            return tomllib.load(fp)\n    except FileNotFoundError:\n        raise InstallationError(f\"{path} not found. Cannot resolve '--group' option.\")\n    except tomllib.TOMLDecodeError as e:\n        raise InstallationError(f\"Error parsing {path}: {e}\") from e\n    except OSError as e:\n        raise InstallationError(f\"Error reading {path}: {e}\") from e\n","sourceCodeStart":66,"sourceCodeEnd":87,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/req/req_dependency_group.py#L66-L87","documentation":"Raised when the pyproject.toml referenced by '--group' exists but fails to parse as TOML (tomllib.TOMLDecodeError). pip wraps the underlying decoder error so the user sees the offending file and the parser's detail. Dependency-group resolution cannot proceed without valid TOML.","triggerScenarios":"Calling 'pip install --group ./pyproject.toml:dev' where pyproject.toml has a syntax error: unterminated string, duplicate keys, a bare value where a table is expected, mixed tabs/spaces in a multiline array, or trailing characters after a value.","commonSituations":"Hand-editing pyproject.toml and forgetting a quote or comma; merging a branch that left a conflict marker ('<<<<<<<') in the file; tooling that writes partial TOML; copy-pasting a snippet that uses '=' inside an inline table incorrectly.","solutions":["Run a TOML linter/validator on the file (e.g. 'python -c \"import tomllib,sys; tomllib.load(open(sys.argv[1],\\\"rb\\\"))\" ./pyproject.toml') to surface the exact location.","Open pyproject.toml at the line/column reported in {e} and fix the syntax.","Remove any git conflict markers ('<<<<<<<', '=======', '>>>>>>>') left from an unresolved merge.","Re-validate after editing by re-running the tomllib load before retrying pip."],"exampleFix":"# before — pyproject.toml\n[dependency-groups]\ndev = [\"pytest  \"ruff\"]   # missing comma\n\n# after\n[dependency-groups]\ndev = [\"pytest\", \"ruff\"]","handlingStrategy":"validation","validationCode":"import tomllib, sys\npath = sys.argv[1]\ntry:\n    with open(path, 'rb') as f:\n        tomllib.load(f)\nexcept tomllib.TOMLDecodeError as e:\n    raise SystemExit(f'fix TOML first: {e}')","typeGuard":"def is_valid_toml(path: str) -> bool:\n    import tomllib\n    try:\n        with open(path, 'rb') as f:\n            tomllib.load(f)\n        return True\n    except (tomllib.TOMLDecodeError, OSError):\n        return False","tryCatchPattern":"import tomllib\ntry:\n    with open(path, 'rb') as f:\n        tomllib.load(f)\n    run_pip(['install', '--group', f'{path}:dev'])\nexcept tomllib.TOMLDecodeError as e:\n    print(f'TOML invalid: {e}; edit then retry')","preventionTips":["Validate pyproject.toml in a pre-commit hook with a TOML linter.","Never commit a file with git conflict markers.","Run 'python -m tomllib' load in CI before pip."],"tags":["dependency-groups","pep735","toml","config"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}