def load_scenario(self, ctx):
        """
        Tries to load the scenario given its id and evaluation key
        If it fails, it shows an error page with options to edit/delete.
        """
        view_state = ctx.panel.get_state("view") or {}
        eval_id = view_state.get("id")
        eval_key = view_state.get("key")
        computed_eval_key = ctx.params.get("key", eval_key)
        scenario_id = str(ctx.params.get("id", "") or "")

        try:
            if scenario_id:
                scenario = self.get_scenario(ctx, eval_id, scenario_id)
                validated_scenario, changes = self.validate_scenario_subsets(
                    ctx, scenario
                )

                if changes:
                    # can't load the scenario at all
                    if not validated_scenario.get("subsets"):
                        raise ValueError("Failed to load scenario")

                    # can load the scenario - but it might need an edit
                    ctx.panel.set_state(
                        f"scenario_{scenario_id}_changes",
                        {
                            "scenario": scenario,
                            "changes": changes,
                            "id": scenario_id,
                        },
                    )
                else:
                    ctx.panel.set_state(
                        f"scenario_{scenario_id}_changes",
                        None,
                    )

                scenario_data = self.get_scenario_data(ctx, validated_scenario)

                ctx.panel.set_state("scenario_load_error", None)
                ctx.panel.set_data(
                    f"scenario_{scenario_id}_{computed_eval_key}",
                    scenario_data,
                )
                ctx.panel.set_state("scenario_loading", False)
        except Exception:
            ctx.panel.set_state("scenario_loading", False)
            msg = f"We couldn't load this scenario because the underlying data has changed or been removed. To continue your analysis you can,"
            ctx.panel.set_state(
                "scenario_load_error",
                {
                    "code": "scenario_load_error",
                    "error": msg,
                    "id": scenario_id,
                },
            )

        Tries to load the scenario given its id and evaluation key
        If it fails, it shows an error page with options to edit/delete.
        
plugins/panels/model_evaluation/__init__.py