Summary
In a project containing multiple UIBundle components, deploying one bundle with sf project deploy start -d <path-to-bundle> (or -m UIBundle:<name>) fails with ExpectedSourceFilesError because a different, sibling UIBundle, not included in the deploy, has no built dist/ directory. The source resolver appears to validate the ui-bundle.json outputDir of every UIBundle in the package directory regardless of the requested deploy scope, so one unbuilt bundle blocks all deploys in the project.
Steps To Reproduce
Repro repo: https://github.com/SamanAttar/UIBundleCLIDemo (AppA has a built dist/, AppB does not).
From scratch:
- Create a project and generate two React UI bundles side by side:
sf template generate ui-bundle -n AppA -d "./force-app/main/default/uiBundles" -t reactbasic
sf template generate ui-bundle -n AppB -d "./force-app/main/default/uiBundles" -t reactbasic
- Build only AppA so that
AppA/dist/ exists but AppB/dist/ does not:
cd force-app/main/default/uiBundles/AppA
npm i && npm run build
cd -
Both AppA/ui-bundle.json and AppB/ui-bundle.json contain the default { "outputDir": "dist", ... }.
- Authenticate/point at a source-tracked org (in my case a scratch org) and set it as the default
target-org.
- With pending tracked changes present, deploy only AppA from the project root:
sf project deploy start --source-dir force-app/main/default/uiBundles/AppA
# or:
sf project deploy start --metadata UIBundle:AppA
The deploy of AppA fails citing AppB's missing dist/.
Expected result
Deploying AppA (-d force-app/main/default/uiBundles/AppA or -m UIBundle:AppA) should resolve and validate only the requested component(s). The build state of an unrelated sibling bundle (AppB) that is not part of the deploy scope should not cause AppA's deploy to fail.
Actual result
The deploy aborts with an error pointing at the sibling bundle that was never requested:
Error (ExpectedSourceFilesError): ui-bundle.json 'outputDir' references "dist", but the directory does not exist at /Users/saman/Developer/UIBundleCLIDemo/force-app/main/default/uiBundles/AppB/dist.
Try this:
Create the directory "dist" in your UI bundle, or change outputDir to an existing directory.
The same error occurs for --metadata UIBundle:AppA. Any single unbuilt UIBundle blocks every deploy in the project.
Additional information
- Workaround is obviously to build the other UIBundles
- Same failure when deploying via VS Code right-click context menu commands from the SFDX Extension
System Information
{
"architecture": "darwin-arm64",
"cliVersion": "@salesforce/cli/2.138.6",
"nodeVersion": "node-v20.19.5",
"osVersion": "Darwin 25.1.0",
"rootPath": "/Users/saman/.nvm/versions/node/v20.19.5/lib/node_modules/@salesforce/cli",
"shell": "zsh",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.2.50 (core)",
"@oclif/plugin-commands 4.1.57 (core)",
"@oclif/plugin-help 6.2.50 (core)",
"@oclif/plugin-not-found 3.2.87 (core)",
"@oclif/plugin-plugins 5.4.72 (core)",
"@oclif/plugin-search 1.2.50 (core)",
"@oclif/plugin-update 4.7.46 (core)",
"@oclif/plugin-version 2.2.47 (core)",
"@oclif/plugin-which 3.2.55 (core)",
"@salesforce/cli 2.138.6 (core)",
"agent 1.42.0 (core)",
"apex 3.9.32 (core)",
"api 1.3.37 (core)",
"auth 4.4.1 (core)",
"code-analyzer 5.6.1 (user) published 226 days ago (Wed Oct 29 2025) (latest is 5.13.0)",
"data 4.0.106 (core)",
"deploy-retrieve 3.24.54 (core)",
"info 3.4.139 (core)",
"lightning-dev 6.2.17 (user) published 77 days ago (Fri Mar 27 2026)",
"limits 3.3.92 (core)",
"marketplace 1.3.29 (core)",
"org 5.11.6 (core)",
"packaging 2.28.6 (core)",
"schema 3.3.116 (core)",
"settings 2.4.82 (core)",
"sobject 1.4.111 (core)",
"telemetry 3.8.24 (core)",
"templates 56.18.0 (core)",
"trust 3.8.13 (core)",
"ui-bundle-dev 1.2.2 (user) published 73 days ago (Tue Mar 31 2026)",
"user 3.10.1 (core)",
"apex-mutation-testing 1.7.0 (link) /Users/saman/Developer/apex-mutation-testing"
]
}
Summary
In a project containing multiple
UIBundlecomponents, deploying one bundle withsf project deploy start -d <path-to-bundle>(or-m UIBundle:<name>) fails withExpectedSourceFilesErrorbecause a different, sibling UIBundle, not included in the deploy, has no builtdist/directory. The source resolver appears to validate theui-bundle.jsonoutputDirof every UIBundle in the package directory regardless of the requested deploy scope, so one unbuilt bundle blocks all deploys in the project.Steps To Reproduce
Repro repo: https://github.com/SamanAttar/UIBundleCLIDemo (AppA has a built
dist/, AppB does not).From scratch:
AppA/dist/exists butAppB/dist/does not:AppA/ui-bundle.jsonandAppB/ui-bundle.jsoncontain the default{ "outputDir": "dist", ... }.target-org.sf project deploy start --source-dir force-app/main/default/uiBundles/AppA # or: sf project deploy start --metadata UIBundle:AppAThe deploy of AppA fails citing AppB's missing
dist/.Expected result
Deploying AppA (
-d force-app/main/default/uiBundles/AppAor-m UIBundle:AppA) should resolve and validate only the requested component(s). The build state of an unrelated sibling bundle (AppB) that is not part of the deploy scope should not cause AppA's deploy to fail.Actual result
The deploy aborts with an error pointing at the sibling bundle that was never requested:
The same error occurs for
--metadata UIBundle:AppA. Any single unbuilt UIBundle blocks every deploy in the project.Additional information
System Information
{ "architecture": "darwin-arm64", "cliVersion": "@salesforce/cli/2.138.6", "nodeVersion": "node-v20.19.5", "osVersion": "Darwin 25.1.0", "rootPath": "/Users/saman/.nvm/versions/node/v20.19.5/lib/node_modules/@salesforce/cli", "shell": "zsh", "pluginVersions": [ "@oclif/plugin-autocomplete 3.2.50 (core)", "@oclif/plugin-commands 4.1.57 (core)", "@oclif/plugin-help 6.2.50 (core)", "@oclif/plugin-not-found 3.2.87 (core)", "@oclif/plugin-plugins 5.4.72 (core)", "@oclif/plugin-search 1.2.50 (core)", "@oclif/plugin-update 4.7.46 (core)", "@oclif/plugin-version 2.2.47 (core)", "@oclif/plugin-which 3.2.55 (core)", "@salesforce/cli 2.138.6 (core)", "agent 1.42.0 (core)", "apex 3.9.32 (core)", "api 1.3.37 (core)", "auth 4.4.1 (core)", "code-analyzer 5.6.1 (user) published 226 days ago (Wed Oct 29 2025) (latest is 5.13.0)", "data 4.0.106 (core)", "deploy-retrieve 3.24.54 (core)", "info 3.4.139 (core)", "lightning-dev 6.2.17 (user) published 77 days ago (Fri Mar 27 2026)", "limits 3.3.92 (core)", "marketplace 1.3.29 (core)", "org 5.11.6 (core)", "packaging 2.28.6 (core)", "schema 3.3.116 (core)", "settings 2.4.82 (core)", "sobject 1.4.111 (core)", "telemetry 3.8.24 (core)", "templates 56.18.0 (core)", "trust 3.8.13 (core)", "ui-bundle-dev 1.2.2 (user) published 73 days ago (Tue Mar 31 2026)", "user 3.10.1 (core)", "apex-mutation-testing 1.7.0 (link) /Users/saman/Developer/apex-mutation-testing" ] }