+ Start a Discussion
ilewi121ilewi121 

Deployment Error

I attempted to save an apex test class in our sandbox, but received the following error message:
 
An unexpected error has occurred. 1453659855-92905 (-2090026019) for deploymentId=1dre0000001FXv9AAG If this persists, please contact customer support.

Attempted Solutions: I found a similar issue, but I am unable to test their suggestion of refreshing my sandbox:
https://developer.salesforce.com/forums/?id=906F0000000AXfsIAG

Has anyone else come across this and found a solution other than wiping their sandbox?
Best Answer chosen by ilewi121
ilewi121ilewi121
So I found the issue. I copied code from a bulk test to a single record test, but forgot to change the way I constructed my map. When Apex tried to use the Map constructor with one record, instead of a list, it errored out.

A very simple mistake, but Salesforce didn't have an error message for it. 
 
//Bulk (Right):
List<Case> cas = new List<Case>();
Set<Id> CaseIds = new Map<Id,Case>(cas).keySet();

//Single (Wrong):
Case cas = new Case();
Set<Id> CaseIds = new Map<Id,Case>(cas).keySet();

//Single (Right):
Case cas = new Case();
Set<Id> CaseIds = new Set<Id>();
CaseIds.add(cas);

All Answers

Andy BoettcherAndy Boettcher
Typically for me when that happens in Developer Console, I just delete and recreate my workspace.  I see you had a bullet about that above, but did you try it?
ilewi121ilewi121
Thanks for the suggestion, Andy, but yes I already tried deleting my workspaces and to no avail.
ilewi121ilewi121
So I found the issue. I copied code from a bulk test to a single record test, but forgot to change the way I constructed my map. When Apex tried to use the Map constructor with one record, instead of a list, it errored out.

A very simple mistake, but Salesforce didn't have an error message for it. 
 
//Bulk (Right):
List<Case> cas = new List<Case>();
Set<Id> CaseIds = new Map<Id,Case>(cas).keySet();

//Single (Wrong):
Case cas = new Case();
Set<Id> CaseIds = new Map<Id,Case>(cas).keySet();

//Single (Right):
Case cas = new Case();
Set<Id> CaseIds = new Set<Id>();
CaseIds.add(cas);
This was selected as the best answer