0

I am trying to debug a piece of code where I get the error : list index out of bounds: 0

In this case do I need to look for:ZcheckoutBaseFor.validateConfiguration() or could this also be :Controller2.getCustomSettingName() as i do not see which linenumber throws the error. I asume this is a null error of a list returning empty.

16412:52:55.0 (50004464)|METHOD_EXIT|[102]|01pb0000004oq1l|Controller2.getCustomSettingName()
    16512:52:55.0 (50020741)|METHOD_EXIT|[26]|01pb0000004oq1n|ZcheckoutBaseFor.validateConfiguration()
    16612:52:55.0 (50964441)|SYSTEM_MODE_EXIT|false
    16712:52:55.0 (51144832)|FATAL_ERROR|System.ListException: List index out of bounds: 0
  • 1
    There should be a stack trace somewhere in your log. I find that logging Apex at "Finest" tends to be too noisy to be useful (unless I'm working with the Apex Replay Debugger in VSCode). Try turning down your log levels and see if that makes it easier to find the stack trace. – Derek F Feb 28 at 13:34
1

Just after that line you should see the full error trace. A real example:

13:56:10.0 (165686588)|FATAL_ERROR|System.ListException: List index out of bounds: 0

**Class.ControllerPaymentMethods.wrapper.<init>: line 294, column 1**
Class.ControllerPaymentMethods.getWrappers: line 180, column 1
Class.ControllerPaymentMethods.initialise: line 93, column 1
Class.ControllerPaymentMethods.<init>: line 51, column 1

Error is in line 294 in ControllerPaymentMethods

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.