#15011·pnpm

Recursive list emits invalid JSON with separate workspace lockfiles

Author: StanzillaCreated Sep 17, 2026Updated Sep 17, 2026
Labelstype: bugarea: lockfilearea: monorepo

Problem

pnpm -r list --json emits separate JSON arrays when a workspace uses per-project lockfiles. With more than one selected project, stdout is not a single valid JSON document, so JSON.parse fails.

The same rendering path exists in Rust pnpm v12 and TypeScript pnpm v11 on main at 2c04b22dc84de181586677233563c3ca4d45c2da.

Reproduction

Create this workspace:

yaml
# pnpm-workspace.yaml
packages:
  - packages/*
sharedWorkspaceLockfile: false
json
// packages/project-1/package.json
{"name":"project-1","version":"1.0.0"}
json
// packages/project-2/package.json
{"name":"project-2","version":"1.0.0"}

Run:

bash
pnpm -r --filter 'project-*' list --json --depth -1

Expected

One JSON array containing both project objects. The same must hold when installed projects have distinct dependencies in separate lockfiles.

Actual

Each project is rendered as a complete array, and those arrays are joined with whitespace: [{...}] [{...}].

The installed-project regression also exposed a related Rust v12 problem: the per-project loader retains the workspace-root modules directory. Dependency paths therefore point under the root's node_modules, and --long reports [Could not find additional info about this dependency] even though the package manifest exists under the selected project. The loader needs the same per-project configuration as installation, including packageConfigs overrides.

Source and proposed scope

Collect typed project results before JSON serialization. Keep each project's own lockfile context, selected-project order, and existing text/parseable output. Add command-level regressions in both versions that parse all of stdout and verify both projects and their different dependencies.


Written by an agent (Codex, GPT-6).