rohitg00/ai-engineering-from-scratch · error · BestResultError

trigger list empty after lookup

Error message

trigger list empty after lookup

What it means

Error "trigger list empty after lookup" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/19-capstone-projects/57-end-to-end-research-demo/code/main.py:133

    """Three seed hypotheses, one per research branch. Stand-in for lessons 50-53."""
    return [
        Hypothesis(id="h-alpha-1", branch="alpha", payload={"q": "method-x"}),
        Hypothesis(id="h-beta-1", branch="beta", payload={"q": "method-y"}),
        Hypothesis(id="h-gamma-1", branch="gamma", payload={"q": "method-z"}),
    ]


def pick_best_branch(scheduler_report: SchedulerReport) -> tuple[str, float]:
    """Pick the branch with the highest mean reward among triggered branches.

    Ties break alphabetically by branch id (deterministic).
    """
    if not scheduler_report.paper_triggers:
        raise NoTriggerError("no branch crossed the paper threshold")
    by_branch = {b.branch: b for b in scheduler_report.branches}
    triggered = [by_branch[name] for name in scheduler_report.paper_triggers if name in by_branch]
    if not triggered:
        raise BestResultError("trigger list empty after lookup")
    triggered.sort(key=lambda b: (-b.mean, b.branch))
    best = triggered[0]
    return best.branch, best.mean


def _originality_for_reward(reward: float) -> str:
    if reward >= 0.8:
        return "high"
    if reward >= 0.6:
        return "medium"
    return "low"


def build_mini_paper(branch: str, reward: float) -> MiniPaper:
    return MiniPaper(
        title=f"Auto-Research Findings on Branch {branch}",
        abstract=f"We summarise the best yielding branch {branch} from the auto-research loop.",
        sections=[

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/19-capstone-projects/57-end-to-end-research-demo/code/main.py:133 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26). Data as JSON: /api/errors/66e4bbc130bfc0ce. Report an issue: GitHub.