NPE Exception when trying to deploy metadata field relationship

Issue #1959 resolved
Justin Julicher created an issue

Got the following when trying to deploy a metadata field (a copy of another) relationship and the relationship name/label existed already.

    <relationshipLabel>RelatedLabel3</relationshipLabel>
    <relationshipName>RelatedLabel3</relationshipName>
5,033 [ 165460]   INFO - r.ForceComSfdxMetadataDeployer - Package.xml file found at C:/Users/justinj/Workspace/GRE Salesforce Phase One/manifest/package.xml 
2021-08-13 09:58:28,522 [ 168949]   INFO - r.ForceComSfdxMetadataDeployer - Deployment status = FAILED 
2021-08-13 09:58:28,522 [ 168949]   WARN - r.ForceComSfdxMetadataDeployer -   Found ERROR for CustomField objects/ApprovalProcess__mdt/fields/ParentApprovalTrackedField__c.field-meta.xml: null 
2021-08-13 09:58:28,522 [ 168949]   WARN - .IlluminatedCloudExceptionUtil -  
java.lang.NullPointerException
    at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770)
    at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
    at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
    at java.base/java.util.regex.Pattern.matcher(Pattern.java:1133)
    at com.illuminatedcloud.intellij.lightning.LightningWebComponentsUtil.handleLightningWebComponentError(SourceFile:1160)
    at com.illuminatedcloud.intellij.builder.AbstractForceComMetadataDeployer.processDeploymentResult(SourceFile:802)
    at com.illuminatedcloud.intellij.builder.AbstractForceComMetadataDeployer.access$100(SourceFile:91)
    at com.illuminatedcloud.intellij.builder.AbstractForceComMetadataDeployer$1.run(SourceFile:433)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:998)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:497)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:228)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:228)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:829)
2021-08-13 09:58:33,882 [ 174309]   INFO - rationStore.ComponentStoreIm

TBH the sfdx cli reported

Deploy ID: 0Af8r000000ZVXBCA4
SOURCE PROGRESS | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 0/2 Components

=== Component Failures [1]
Type  Name                                                Problem
────  ──────────────────────────────────────────────────  ────────────────
      CustomMetadata__mdt.RelationshipField__c  undefined (7:61)

So I think the deployment result is slightly different when this is deployed.

Steps to reproduce:

Create custommetadata with SObject relationship.

Create related field to above SOBject.

Retrieve into IntelliJ/webstorm IC.

copy & paste xml of field to another field - update everything except the relationshipName etc.

deploy.

With my Issue I just incremented the suffix by 1 (but that already existed).

Let me know if you can’t reproduce the issue.

Comments (5)

  1. Justin Julicher reporter

    Looking at the log it looks like it was trying to deploy a LWC at the same time - I don’t know why because I hadn’t selected any and there were no changed LWC components.

  2. Scott Wells repo owner

    Okay. I'm traveling today but will take a look early next week. Minimally I'll fix the NPE, but if you're getting an undesired deployment, I'll need to figure out why as well.

  3. Scott Wells repo owner

    Justin, in order to fix this properly, I'd need to see the exact JSON output of that deployment. You can either enable debug logging for metadata deployment in IC2 which will ensure that it's in the log, or you can just run the same deployment with the --json flag. Once I have that I can look at why IC2's pattern matcher doesn't handle the deployment result properly.

  4. Scott Wells repo owner

    This shouldn't NPE as of 2.1.8.8, but the reported error message may not be great. Basically there are some error messages reported from CLI-based deployments of LWC components that mangle important information such as line/column numbers into the message itself. IC2 tries to extract that info, and in this case it looks like the error message is just the line/column and nothing else. So that's how it's going to be reported, and that problem won't be hyperlinked to that code location. But it also won't error anymore.

  5. Log in to comment