function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sneha MogaliSneha Mogali 

There was an unexpected error in your org which is preventing this assessment check from completing: System.ListException: List index out of bounds: 0

I got the above error while trying to "Create an Indicator Badge Apex Service "
And the code of INDICATOR_Controller  shown as below 
public class INDICATOR_Controller {
    private static SObject sobj;
    public static String getSObjectLabel(String sObjName){
        String label = Schema.getGlobalDescribe().get(sObjName).getDescribe().getLabel();
        return label;
    public static List<INDICATOR_Service.Indicator> getIndicators(String recId, String objectName){
        getSObject(recId, objectName);
        if(sobj != NULL){
            List<INDICATOR_Service.Indicator> indicators = INDICATOR_Service.getIndicatorBadgesForObject(sobj);
            return indicators;
        } else{
            return null;
    public static void getSObject(String recId, String objectName){
        List<String> fNames = INDICATOR_Service.getFieldsToQueryForObject(objectName);
        if(fNames.size() > 0){
            String query = 'SELECT Id,'+ String.join(fNames,',')+' FROM '+ objectName +' WHERE Id =\''+ recId +'\' LIMIT 1';
            List<SObject> results = Database.query(query);
            if(results.size() == 1){
                sobj = results[0];

Please Help!

Sneha M.
Hi Sneha Mogali,
Your query is not satisfying your condition. better you try to write the query in try(), catch() block. 

Warm Regards 

Martha VMartha V
I just went through this same problem. What I did was looked at the log and found out that the trailhead is looking for a contact with name 'Gerta' that doesn't exist. So I just added a new contact with that name and that passed the challenge.

Martha VMartha V
So my solution above worked for that part of the module, but then as you continue you will see that there is data that your org is missing. 
I edited the Visualforce page LoadZBSData and just added an alert where it is setting the dates. I saved it and ran it, and lo and behold, after it showed my alert it actually worked and gave me the success alert that I hadn't seen before. Now I have all the data needed to see the component working in all it's glory!

code in visualforce page
I have no idea why this worked.
Sneha MogaliSneha Mogali
Thankyou Martha I was able to pass the challenge by adding a new contact with name Gerta :)
Peter Greenbaum 7Peter Greenbaum 7
I got this message too.  There seems to be some kind of an error deleted cases and closed opportunities.  I discovered this by opening the dev console in chrome (F12) and firing the initialize data page.  Since the old data isn't getting cleared out, the test data isn't being created.  You can find and delete the opportunities and cases in a anonymous execution window in the dev console, or manually removing the opportunties/cases in list view or account view.  Once the existing records are removed, the new data can be inserted and then you can complete the trailhead tasks and assessments.
Thank you Martha, it is ok for me now by creating a new contact with Gerta as last name.
My problem is we have no indication for this isssue in the trail's content
Neil Penso 11Neil Penso 11
This is still a bug two years later.
Cherukoori YashaswiCherukoori Yashaswi
can you please explain me how to add a contact in virtualforce page
Lesego Sebopa 8Lesego Sebopa 8
User-added image
Please do this then Verify step.
Please like this if it works for you.