question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

force: package: version: create fails to reference Case metadata

See original GitHub issue

Summary

Running sfdx force:package:version:create command fails to find references to Case object metadata

Steps To Reproduce:

I’ve opened a case regarding this advised to add an issue here and link the case to it. The case contains the failing DX Project code.

Expected result

Successful package creation.

Actual result

Package creation fails. Error message appears to indicate that Case metadata (standard or custom) does not exist.

{
  "status": 1,
  "name": "",
   "message": "Multiple errors occurred:\n(1) ClassA: Variable does not exist: CaseFieldA__c\n(2) ClassATest: Field does not exist: RecordtypeId on Case\n(3) ClassATest: Variable does not exist: CaseFieldB__c\n(4) ClassATest: Variable does not exist: CaseFieldC__c\n
   ...
   (490) ClassZTest: Variable does not exist: CaseFieldY__c\n(491) ClassZTest: Variable does not exist: CaseFieldZ__c\n",
   "exitCode": 1,
  "context": "PackageVersionCreateCommand",
  "stack": "Multiple errors occurred:\n(1) ClassA: Variable does not exist: CaseFieldA__c\n(2) ClassATest: Field does not exist: RecordtypeId on Case\n(3) ClassATest: Variable does not exist: CaseFieldB__c\n(4) ClassATest: Variable does not exist: CaseFieldC__c\n
   ...
   (490) ClassZTest: Variable does not exist: CaseFieldY__c\n(491) ClassZTest: Variable does not exist: CaseFieldZ__c\n    at Function.wrap (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/sfError.js:61:25)\n    at PackageVersionCreateCommand.catch (/usr/local/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/ToolbeltCommand.js:255:44)\n    at async PackageVersionCreateCommand._run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:106:13)\n    at async Config.runCommand (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/core/lib/config/config.js:272:25)\n    at async run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/core/lib/main.js:76:5)\nCaused by: Error: Multiple errors occurred:\n(1) ClassA: Variable does not exist: CaseFieldA__c\n(2) ClassATest: Field does not exist: RecordtypeId on Case\n(3) ClassATest: Variable does not exist: CaseFieldB__c\n(4) ClassATest: Variable does not exist: CaseFieldC__c\n
   ...
   (490) ClassZTest: Variable does not exist: CaseFieldY__c\n(491) ClassZTest: Variable does not exist: CaseFieldZ__c\n    at /usr/local/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/package/packageUtils.js:712:27\n    
at processTicksAndRejections (node:internal/process/task_queues:96:5)",
  "warnings": [],
  "commandName": "PackageVersionCreateCommand"
}

System Information

  • Which shell/terminal are you using? bash
{
  "cliVersion": "sfdx-cli/7.172.0",
  "architecture": "linux-x64",
  "nodeVersion": "node-v16.18.0",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 1.3.1 (core)",
    "@oclif/plugin-commands 2.2.0 (core)",
    "@oclif/plugin-help 5.1.14 (core)",
    "@oclif/plugin-not-found 2.3.3 (core)",
    "@oclif/plugin-plugins 2.1.1 (core)",
    "@oclif/plugin-update 3.0.2 (core)",
    "@oclif/plugin-version 1.1.2 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.6 (core)",
    "@oclif/plugin-which 2.1.0 (core)",
    "alias 2.1.5 (core)",
    "apex 1.2.0 (core)",
    "auth 2.2.13 (core)",
    "community 2.0.3 (core)",
    "config 1.4.21 (core)",
    "custom-metadata 2.0.1 (core)",
    "data 2.1.4 (core)",
    "generator 2.0.5 (core)",
    "info 2.1.9 (core)",
    "limits 2.0.5 (core)",
    "org 2.2.7 (core)",
    "packaging 1.9.4 (core)",
    "schema 2.1.10 (core)",
    "signups 1.2.7 (core)",
    "source 2.0.17 (core)",
    "telemetry 2.0.2 (core)",
    "templates 55.1.0 (core)",
    "trust 2.0.4 (core)",
    "user 2.1.10 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)",
    "salesforce-alm 54.8.1 (core)"
  ],
  "osVersion": "Linux 5.15.0-1021-azure",
  "shell": "unknown",
  "rootPath": "/usr/local/lib/node_modules/sfdx-cli"
}

Additional information

Using same package files to create a package version… Works on cli version 7.170.0 on linux or win32-x64 Works on cli version 7.171.0 on win32-x64 only

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
6ithu8u53rcommented, Dec 1, 2022

This appears to be fixed in the latest (7.179.0) release.

0reactions
cromwellryancommented, Dec 1, 2022

Thanks for following up here @6ithu8u53r! Glad you’re unblocked!

Read more comments on GitHub >

github_iconTop Results From Across the Web

salesforcedx cli - 2GP Managed Package : ERROR running ...
I am trying to create a managed package version ...
Read more >
Can't create package version. - Salesforce Developers
I am using sfdx force:package:version:create command to create a new version of my 2GP package. However I am getting the following error:
Read more >
DNF Command Reference — dnf latest documentation
`DNF`_ is the next upcoming major version of `YUM`_, a package manager for RPM-based ... This command by default does not force a...
Read more >
Most Frequently used SFDX Commands – Home - Jitendra Zaa
If we already have Salesforce Metadata API, Force.com IDE and other tools then why do ... 1, sfdx force:package:version:create -a "Log framework 2.0...
Read more >
Metadata API Developer Guide
Use Cases for Metadata API . ... Learn more about metadata and package.xml files. Build a ... sfdx force:project:create -n YourProjectName.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found