Skip to content

cargo metadata workspace_default_members behaves differently when executed within a member package #16834

@tonywu6

Description

@tonywu6

Problem

When executed within the directory of a member package, cargo metadata returns a workspace_default_members array that only contains the member package itself, as opposed to the full list of resolved members as specified by the workspace manifest.

Steps

  1. Create a minimal virtual manifest:
    [workspace]
    resolver = "2"
  2. cargo new package1
  3. cargo new package2
  4. cd package1
  5. cargo metadata --format-version 1 | jq '.workspace_default_members' (Using jq for readability)
[
  "path+file:///.../package1#0.1.0"
] // expected both packages

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.94.0 (85eff7c80 2026-01-15)
release: 1.94.0
commit-hash: 85eff7c80277b57f78b11e28d14154ab12fcf643
commit-date: 2026-01-15
host: aarch64-apple-darwin
libgit2: 1.9.2 (sys:0.20.3 vendored)
libcurl: 8.7.1 (sys:0.4.84+curl-8.17.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Mac OS 15.7.5 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugCommand-metadataS-triageStatus: This issue is waiting on initial triage.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions