Skip to content

turbo prune --docker corrupts bun.lock entries for file: protocol dependencies #11701

@sigmachirality

Description

@sigmachirality

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/sigmachirality/turborepo-prune-bun-file-package

Which canary version will you have in your reproduction?

2.8.3-canary.7

Environment information

CLI:
   Version: 2.8.3-canary.7
   Package manager: bun
Platform:
   Architecture: aarch64
   Operating system: macos

Expected behavior

turbo prune --docker should preserve the original 2-element array format for file: dependency entries in bun.lock:

"@api/alloy-public": ["@api/alloy-public@file:apps/api/.api/apis/alloy-public", { "dependencies": { ... } }]

Actual behavior

turbo prune inserts an extraneous empty string "" at position 1, turning the 2-element array into a 4-element array:

"@api/alloy-public": ["@api/alloy-public@file:apps/api/.api/apis/alloy-public", "", { "dependencies": { ... } }, ""]

This causes bun install --frozen-lockfile to fail with error: Expected an object.

To Reproduce

git clone https://github.com/sigmachirality/turborepo-turbo-prune-bun-file-package
cd turborepo-turbo-prune-bun-file-package
bun install
npx turbo prune @repro/api --docker

# Original lockfile is valid
bun install --frozen-lockfile  # succeeds

# Pruned lockfile is corrupted
cd out/json
bun install --frozen-lockfile  # fails: "error: Expected an object"

Additional context

The root cause appears to be that turbo’s bun.lock re-serializer assumes all package entries have an integrity hash at position 1. For file: protocol dependencies, bun omits the integrity hash, producing a 2-element array [ident, info]. Turbo inserts empty strings for the missing fields, corrupting the entry into [ident, "", info, ""].

Seems related to: #11266

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions