Salesforce System Error when accessing a list in @AuraEnabled method

My Lightning Component controller:

doActivateNext : function(component, event, helper) {
    var action = component.get("c.activateNext");
    action.setParams({ bpiId : component.get("v.recordId"), 
                       stages : component.get("v.stages") });

calls this @AuraEnabled Apex method:

public static void activateNext(Id bpiId, List<BpiStage> stageList) {
    System.debug(stageList); // I see a non-empty list in the logs

    for(BpiStage stage : stageList) {
        System.debug(stage); // Fails before outputt

The System.debug() in line 3 perfectly prints a list of objects of the BpiStage class. But as soon stages is access in the for loop (or any other method like .isEmpty() or .get(0) or [0]) the code fails with a:

11:55:45:030 FATAL_ERROR System.UnexpectedException: Salesforce System
Error: 1261878509-48218 (152924272) (152924272)

What is going on here?


Looks weird,might be a bug. As a workaround, try passing the stages array as string from the component and deserialize the string to List<BpiStage> in the apex controller.


ction.setParams({ bpiId : component.get("v.recordId"), 
                  stages : JSON.stringify(component.get("v.stages")) });


public static void activateNext(Id bpiId, String stageStr) {
    List<BpiStage> stageList = (List<BpiStage>)JSON.deserialize(stageStr,List<BpiStage>.class)

    for(BpiStage stage : stageList) {

Source : Link , Question Author : Robert Sösemann , Answer Author : Praveen

Leave a Comment