github/spec-kit · error · ValueError

Shared infrastructure path escapes project root: {label}

Error message

Shared infrastructure path escapes project root: {label}

What it means

Error "Shared infrastructure path escapes project root: {label}" thrown in github/spec-kit.

Source

Thrown at src/specify_cli/shared_infra.py:171

    """Return the bundled/source shared scripts directory."""
    if core_pack and (core_pack / "scripts").is_dir():
        return core_pack / "scripts"
    return repo_root / "scripts"


def _shared_destination_label(project_path: Path, dest: Path) -> str:
    try:
        return dest.relative_to(project_path).as_posix()
    except ValueError:
        return str(dest)


def _shared_relative_path(project_path: Path, dest: Path) -> Path:
    try:
        rel = dest.relative_to(project_path)
    except ValueError:
        label = _shared_destination_label(project_path, dest)
        raise ValueError(f"Shared infrastructure path escapes project root: {label}") from None

    if rel.is_absolute() or ".." in rel.parts:
        label = _shared_destination_label(project_path, dest)
        raise ValueError(f"Shared infrastructure path escapes project root: {label}")
    return rel


def _ensure_safe_shared_directory(
    project_path: Path,
    directory: Path,
    *,
    create: bool = True,
    context: str = "shared infrastructure directory",
) -> None:
    """Create a shared infra directory without following symlinked parents."""
    root = project_path.resolve()
    rel = _shared_relative_path(project_path, directory)
    current = project_path

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Move the shared infrastructure path inside the project root, or adjust the project root.

When it happens

Trigger: Thrown at src/specify_cli/shared_infra.py:171 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of github/spec-kit@bf88c9f9a8 (2026-08-14). Data as JSON: /api/errors/bd65a9ba9359266c. Report an issue: GitHub.