Skip to content

💥 Crash on bun install from Git repository subdirectory #28105

@e6

Description

@e6

Description

Bun is experiencing a fatal crash (Segmentation Fault / Illegal Instruction) when attempting to install a dependency located within a subdirectory of a remote Git repository. While Bun supports standard Git dependencies, the additional path: or subdirectory resolution logic appears to trigger a memory or assertion failure during the cloning/hoisting phase.

🔍 Observed Issue

  • The Crash: Running bun install with a subdirectory-based Git dependency causes Bun to exit immediately with a core dump or panic: Internal assertion failure.
  • The Trigger: This specifically occurs when using the syntax for sub-packages within a monorepo, e.g.:
    "dependency": "git+https://github.com/user/repo.git#path:packages/sub-package"
  • Current State: The package manager fails to properly resolve the package.json inside the specified path, leading to a crash in PackageManagerTask.zig.

✨ Expected Behavior

Bun should:

  1. Clone the repository into the local cache.
  2. Navigate to the specified subdirectory path.
  3. Install the package and its dependencies as a standard linked dependency, similar to pnpm or npm.

🛠️ Reproduction Steps

  1. Create a new project with bun init.
  2. Add a Git dependency that points to a subdirectory:
    bun add git+[https://github.com/example/monorepo.git#path:libs/my-lib](https://github.com/example/monorepo.git#path:libs/my-lib)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions