{"record":{"id":"53b12424eea9b970","repo":"PrefectHQ/fastmcp","slug":"failed-to-add-editable-packages-e-stderr","errorCode":null,"errorMessage":"Failed to add editable packages: {e.stderr}","messagePattern":"Failed to add editable packages: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/utilities/mcp_server_config/v1/environments/uv.py","lineNumber":254,"sourceCode":"            logger.debug(f\"Adding editable packages: {', '.join(editable_paths)}\")\n            try:\n                subprocess.run(\n                    [\n                        \"uv\",\n                        \"add\",\n                        \"--editable\",\n                        *editable_paths,\n                        \"--no-sync\",\n                        \"--project\",\n                        str(output_dir),\n                    ],\n                    check=True,\n                    capture_output=True,\n                    text=True,\n                )\n            except subprocess.CalledProcessError as e:\n                logger.error(f\"Failed to add editable packages: {e.stderr}\")\n                raise RuntimeError(\n                    f\"Failed to add editable packages: {e.stderr}\"\n                ) from e\n\n        # Final sync to install everything\n        logger.info(\"Installing dependencies...\")\n        try:\n            subprocess.run(\n                [\"uv\", \"sync\", \"--project\", str(output_dir)],\n                check=True,\n                capture_output=True,\n                text=True,\n            )\n        except subprocess.CalledProcessError as e:\n            logger.error(f\"Failed to sync dependencies: {e.stderr}\")\n            raise RuntimeError(f\"Failed to sync dependencies: {e.stderr}\") from e\n\n        logger.info(f\"Environment prepared successfully in {output_dir}\")\n","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/utilities/mcp_server_config/v1/environments/uv.py#L236-L272","documentation":"prepare() runs `uv add --editable <paths> --no-sync --project <dir>` and raises this RuntimeError when uv exits nonzero. It means uv could not add one of the configured editable package directories, typically because the directory is not a buildable Python package. uv's stderr is in the message.","triggerScenarios":"prepare() with environment.editable containing a path that doesn't exist, isn't a directory with a pyproject.toml/setup.py, or whose package fails to build (missing build backend, syntax error at build time).","commonSituations":"Pointing editable at the repo root instead of the package dir lacking pyproject.toml; a typo'd or non-resolved relative path; a local package with a broken hatch/setuptools config; a package needing a build dependency not present.","solutions":["Verify each editable path exists and contains a valid build file (pyproject.toml or setup.py); fix the path in environment.editable.","Read e.stderr: if it's a build error, fix the package's build config or add the missing build requirement.","Test one path manually: `uv add --editable ./my-package --no-sync --project /tmp/t` to identify the offending entry.","If you just want the package importable without installing, remove it from editable and rely on CWD/PYTHONPATH instead.","Regenerate/repair packaging metadata for the local package (e.g. `uv build` in the package dir to check it builds standalone)."],"exampleFix":"// before\n\"editable\": [\".\"]  # repo root has no pyproject.toml\n\n// after\n\"editable\": [\"packages/my-server\"]  # directory containing pyproject.toml","handlingStrategy":"validation","validationCode":"import pathlib\n\nfor e in (cfg.environment.editable or []):\n    p = pathlib.Path(e).resolve()\n    assert p.is_dir(), f\"editable path missing: {p}\"\n    has_meta = (p / \"pyproject.toml\").is_file() or (p / \"setup.py\").is_file()\n    assert has_meta, f\"{p} has no pyproject.toml/setup.py — not installable\"","typeGuard":null,"tryCatchPattern":"try:\n    await env.prepare(output_dir)\nexcept RuntimeError as e:\n    if str(e).startswith(\"Failed to add editable packages\"):\n        print(e)  # stderr identifies the unbuildable path\n    else:\n        raise","preventionTips":["Point editable at the directory containing pyproject.toml, not the repo root","Verify each local package builds standalone (`uv build` in its dir) before wiring it in","Keep packaging metadata (build backend) valid and committed","Prefer absolute or workspace-root-relative paths in config"],"tags":["uv","editable-install","packaging","environment-setup"],"backgroundTag":"editable-install-failed","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}