Skip to content

LATEST dependency resolution incorrectly scoped to --branch for all packages #3517

@dipakparmar

Description

@dipakparmar

Summary

When running sf package version create with the --branch flag, the
LATEST keyword in dependency version numbers is resolved against the
specified branch for all dependency packages, not just the package
being built.

If any dependency package does not have versions published on that
branch, the command fails with NoReleaseVersionFoundForBranchError.

This prevents generating branch beta package versions when dependencies
only have released versions.


Steps To Reproduce

IMPORTANT We cannot provide a public repository because the
packages are part of a managed namespace and private Dev Hub. However,
the issue can be reproduced with the following configuration and
command.

  1. Have a multi-package namespace with dependencies defined using
    LATEST in sfdx-project.json.

Example dependency configuration:

"dependencies": [
  { "package": "Shared Core", "subscriberPackageVersionId": "04tXXXXXXXXXXXX" },
  { "package": "Shared Platform", "subscriberPackageVersionId": "04tXXXXXXXXXXXX" },
  { "package": "Feature Package A", "versionNumber": "3.25.0.LATEST" },
  { "package": "Shared UI Components", "versionNumber": "3.16.0.LATEST" },
  { "package": "Experience Extension", "versionNumber": "3.23.0.LATEST" }
]
  1. Example package setup:
  -----------------------------------------------------------------------
  Package                             Notes
  ----------------------------------- -----------------------------------
  Target Package                      Package being built

  Feature Package A                   Dependency that **has versions on
                                      the branch**

  Experience Extension                Dependency that **does NOT have
                                      versions on the branch**

  Shared UI Components                Dependency that **does NOT have
                                      versions on the branch**
  -----------------------------------------------------------------------
  1. Run the CLI command:
sf package version create \
  --package "<target-package-id>" \
  --code-coverage \
  --definition-file orgs/dev.json \
  --installation-key \
  --version-name "3.13.0" \
  --branch feature/example-branch \
  --json -w 60

Expected result

When --branch is specified:

  • Dependencies that have versions on the specified branch should
    resolve LATEST from that branch.
  • Dependencies that do not have versions on that branch should
    fall back to the latest released version.

The --branch flag should only scope branch resolution to the target
package being built
, not all dependencies.


Actual result

The CLI attempts to resolve LATEST against the specified branch for
all dependencies, even those unrelated to the branch.

If a dependency has no versions on the branch, the command fails
immediately with:

{
  "name": "NoReleaseVersionFoundForBranchError",
  "message": "No version number was found in Dev Hub for package id <dependency-package-id> and branch feature/example-branch and version number 3.23.0.LATEST.",
  "exitCode": 1,
  "context": "PackageVersionCreateCommand",
  "code": "NoReleaseVersionFoundForBranchError"
}

Additional information

This behavior prevents teams from using branch betas to develop and
test isolated features across multiple packages.

Because dependency resolution is scoped to the branch, it is not
possible to create branch-specific beta versions unless all dependency
packages also have versions on that branch
, which is not always
practical.

This issue was initially investigated through Salesforce Support, and we
were advised to raise it here so the CLI product team can review the
behavior.


System Information

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.125.2",
  "nodeVersion": "node-v22.22.0",
  "osVersion": "Darwin 25.3.0",
  "rootPath": "/Users/XXXXXXXX/.local/share/sf/client/2.125.2-30d6901",
  "shell": "zsh",
  "pluginVersions": [
    "@claritisoftware/plugin-clariti 0.0.5 (link) /Users/redactedXXXXX/sf-plugin-clariti",
    "@oclif/plugin-autocomplete 3.2.40 (core)",
    "@oclif/plugin-commands 4.1.40 (core)",
    "@oclif/plugin-help 6.2.37 (core)",
    "@oclif/plugin-not-found 3.2.74 (core)",
    "@oclif/plugin-plugins 5.4.56 (core)",
    "@oclif/plugin-search 1.2.38 (core)",
    "@oclif/plugin-update 4.7.19 (core)",
    "@oclif/plugin-version 2.2.36 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.55 (core)",
    "@oclif/plugin-which 3.2.43 (core)",
    "@salesforce/cli 2.125.2 (core)",
    "agent 1.30.6 (core)",
    "apex 3.9.10 (core)",
    "api 1.3.10 (core)",
    "auth 4.1.6 (core)",
    "code-analyzer 5.10.2 (user) published 0 days ago (Mon Mar 09 2026)",
    "community 3.3.48 (user) published 93 days ago (Sat Dec 06 2025)",
    "data 4.0.73 (core)",
    "deploy-retrieve 3.24.11 (core)",
    "dev 2.5.1 (user) published 475 days ago (Tue Nov 19 2024) (latest is 2.5.2)",
    "info 3.4.105 (core)",
    "limits 3.3.78 (core)",
    "marketplace 1.3.10 (core)",
    "org 5.9.69 (core)",
    "packaging 2.25.5 (core)",
    "schema 3.3.94 (core)",
    "settings 2.4.57 (core)",
    "signups 2.6.56 (user) published 93 days ago (Sat Dec 06 2025)",
    "sobject 1.4.84 (core)",
    "telemetry 3.8.0 (core)",
    "templates 56.9.3 (core)",
    "trust 3.7.114 (core)",
    "user 3.6.52 (core)",
    "sfdx-git-delta 6.31.0 (user) published 24 days ago (Thu Feb 12 2026)"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue or pull request that identifies or fixes a buginvestigatingWe're actively investigating this issuevalidatedVersion information for this issue has been validated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions