Error when class from managed package and class from the org have same name

Issue #471 resolved
Zoran Žunko created an issue

Error:(1, 1) DUPLICATE_VALUE - duplicate value found: <unknown> duplicates value on record with id: <unknown>

Do you need more info?

Comments (10)

  1. Scott Wells repo owner

    Ugh...I thought I'd addressed the last of these a few months back. Yes, if there's a stack trace associated with this in the log, please attach that as well. That will help me see exactly where this is happening. Thanks for reporting!

  2. Zoran Žunko reporter

    Only this part is relevant... it seems that it's trying to recreate the class?!

    2016-11-18 11:46:42,218 [264278914]   INFO - y.ReflectionServiceFactoryBean - Creating Service {urn:tooling.soap.sforce.com}ToolingService from class com.sforce.soap.tooling.ToolingApi 
    2016-11-18 11:46:46,738 [264283434]   INFO - der.ForceComToolingApiDeployer - Using the tooling API to create ApexClass anthologyTriggerDispatch. 
    2016-11-18 11:46:48,425 [264285121]   WARN - der.ForceComToolingApiDeployer - Failures when trying to create missing metadata. Aborting deployment. 
    
  3. Scott Wells repo owner

    Zoran, would you mind adding the following to Help>Debug Log Settings and reproducing the issue:

    #com.illuminatedcloud.intellij.builder.ForceComBuilder
    #com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer
    

    Then please send me the portion of the log emitted by these two classes during the operation. That will hopefully tell me why it's deciding to try to create the class instead of updating it.

  4. Zoran Žunko reporter
    2016-11-18 18:28:29,016 [288385712]  DEBUG - tellij.builder.ForceComBuilder - Checking whether this is a single item static resource or Lightning bundle file deployment using the Tooling API. 
    2016-11-18 18:28:29,016 [288385712]  DEBUG - der.ForceComToolingApiDeployer - Deploying anthologyTriggerDispatch to nbc.flash.dev 
    2016-11-18 18:28:29,024 [288385720]  DEBUG - der.ForceComToolingApiDeployer - Using the tooling API to deploy the following files for module nbc.flash.dev: { anthologyTriggerDispatch.cls }. 
    2016-11-18 18:28:29,024 [288385720]  DEBUG - der.ForceComToolingApiDeployer - Checking for conflicts. 
    2016-11-18 18:28:29,938 [288386634]  DEBUG - tellij.builder.ForceComBuilder - Comparing local to server timestamps for classes/anthologyTriggerDispatch.cls: 
    2016-11-18 18:28:29,938 [288386634]  DEBUG - tellij.builder.ForceComBuilder -   lastDeployedDate       = Mon Oct 31 12:13:09 CET 2016 
    2016-11-18 18:28:29,938 [288386634]  DEBUG - tellij.builder.ForceComBuilder -   serverLastModifiedDate = Wed Nov 16 21:40:05 CET 2016 
    2016-11-18 18:28:29,938 [288386634]  DEBUG - tellij.builder.ForceComBuilder -   localLastModifiedDate  = Fri Nov 18 11:54:45 CET 2016 (raw) 
    2016-11-18 18:28:29,938 [288386634]  DEBUG - tellij.builder.ForceComBuilder -   localLastModifiedDate  = Fri Nov 18 11:54:44 CET 2016 (adjusted) 
    2016-11-18 18:28:29,938 [288386634]  DEBUG - tellij.builder.ForceComBuilder - Local file newer than server representation: classes/anthologyTriggerDispatch.cls 
    2016-11-18 18:28:29,938 [288386634]  DEBUG - der.ForceComToolingApiDeployer - Creating any missing metadata before saving with the Tooling API. 
    2016-11-18 18:28:30,093 [288386789]  DEBUG - der.ForceComToolingApiDeployer - More than one Apex class with name anthologyTriggerDispatch. 
    2016-11-18 18:28:30,163 [288386859]  DEBUG - der.ForceComToolingApiDeployer - Using the tooling API to create the following missing metadata for module nbc.flash.dev: anthologyTriggerDispatch.cls. 
    2016-11-18 18:28:30,163 [288386859]  DEBUG - der.ForceComToolingApiDeployer - Deploying anthologyTriggerDispatch to nbc.flash.dev 
    2016-11-18 18:28:30,163 [288386859]   INFO - der.ForceComToolingApiDeployer - Using the tooling API to create ApexClass anthologyTriggerDispatch. 
    2016-11-18 18:28:30,164 [288386860]  DEBUG - der.ForceComToolingApiDeployer - Sending REST request body to https://magic--dev.cs82.my.salesforce.com/services/data/v38.0/tooling/sobjects/ApexClass:
    {"body":"/**\n * Created by david on 14/08/2016.\n */\n\npublic without sharing class anthologyTriggerDispatch {\n\n// Holds a reference to the currently executing trigger\n    public static anthologyTriggerHandler.Delegate activefunction \u003d null;\n\n// Code control of no triggers\n    public static Boolean noTriggers \u003d FALSE;\n\n// Lists / Maps of objects to update\n\n    public static void Entry(Schema.sObjectType TriggerObject, Boolean IsBefore, Boolean IsDelete, Boolean IsAfter, Boolean IsInsert, Boolean IsUpdate, Boolean IsExecuting, List\u003cSObject\u003e newList, Map\u003cID, SObject\u003e newMap, List\u003cSObject\u003e oldList, Map\u003cID, SObject\u003e oldMap) {\n\n// Check if triggers have been disabled by another class\n        if (noTriggers) {\n            return;\n            }\n\n// Check if triggers are disabled for this user\n        No_Triggers__c noUserTriggers \u003d No_Triggers__c.getInstance(UserInfo.getUserId());\n        if (noUserTriggers.Flag__c) {\n            return;\n        }\n\n        debugContext(TriggerObject, IsBefore, IsDelete, IsAfter, IsInsert, IsUpdate);\n\n// If we were called as the result of an already executing trigger, pass control to the InProgressEntry method of that\n// trigger and let it decide what to do.\n        if (activefunction !\u003d null) {\n            anthologyTriggerHandler.executeInProgress(activefunction);\n            return;\n        }\n\n// Otherwise call the triggers we want to execute\n        if (TriggerObject \u003d\u003d Weekly_Box_Office__c.sObjectType) {\n            anthologyTriggerHandler.execute(new TH_Weekly_Box_Office_Calculate_Fields());\n        }\n        if (TriggerObject \u003d\u003d Contact.sObjectType) {\n            //do a call\n        }\n        if (TriggerObject \u003d\u003d Release__c.sObjectType) {\n            anthologyTriggerHandler.execute(new TH_Release_SetOpeningDay());\n        }\n    }\n\n/**\n * Debug the context for the trigger call\n *\n * Helps us to know which triggers are forwarded by what\n */\n    public static void debugContext(Schema.sObjectType TriggerObject, Boolean IsBefore, Boolean IsDelete, Boolean IsAfter, Boolean IsInsert, Boolean IsUpdate) {\n\n// Get some context string variables for debugging\n        String beforeAfter \u003d IsBefore ? \u0027BEFORE\u0027 : \u0027AFTER\u0027;\n        String dmlOperation;\n        if (IsUpdate) {\n            dmlOperation \u003d \u0027UPDATE\u0027;\n        }\n        else if (IsInsert) {\n            dmlOperation \u003d \u0027INSERT\u0027;\n        }\n        else if (IsDelete) {\n            dmlOperation \u003d \u0027DELETE\u0027;\n        }\n\n        if (activefunction !\u003d null) {\n            System.debug(\u0027*** TRIGGER: \u0027 + beforeAfter + \u0027 \u0027 + dmlOperation + \u0027 trigger on \u0027 + TriggerObject + \u0027 caused by \u0027 + activeFunction.GetTriggerContext().get(\u0027name\u0027));\n            return;\n        }\n        else {\n            System.debug(\u0027*** TRIGGER: \u0027 + beforeAfter + \u0027 \u0027 + dmlOperation + \u0027 trigger on \u0027 + TriggerObject);\n        }\n\n    }\n\n}","name":"anthologyTriggerDispatch"} 
    2016-11-18 18:28:30,674 [288387370]  DEBUG - der.ForceComToolingApiDeployer - Received unexpected response status code 400 != 201. 
    2016-11-18 18:28:30,674 [288387370]  DEBUG - der.ForceComToolingApiDeployer - Response body:
    [{"message":"duplicate value found: <unknown> duplicates value on record with id: <unknown>","errorCode":"DUPLICATE_VALUE","fields":[]}] 
    2016-11-18 18:28:30,680 [288387376]  DEBUG - der.ForceComToolingApiDeployer - Extracting errorCode and message from response body:
    {message=duplicate value found: <unknown> duplicates value on record with id: <unknown>, errorCode=DUPLICATE_VALUE, fields=[]} 
    2016-11-18 18:28:30,683 [288387379]   WARN - der.ForceComToolingApiDeployer - Failures when trying to create missing metadata. Aborting deployment. 
    
  5. Scott Wells repo owner

    That helps. Yes, it's deciding that when there's more than one class with that name, it's the same as having zero. I'll fix that very shortly. Thanks for the diagnostic info!

  6. Scott Wells repo owner

    Okay, I'm about to submit the fix for this. I won't get it into an official release until early next week, but if you'd like a pre-release build with the fix, I'm happy to post that here for you. Just let me know.

  7. Log in to comment