{"record":{"id":"73733cd26b2bd117","repo":"rohitg00/ai-engineering-from-scratch","slug":"max-experiments-must-be-1","errorCode":null,"errorMessage":"max_experiments must be >= 1","messagePattern":"max_experiments must be >= 1","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/56-iteration-scheduler/code/main.py","lineNumber":132,"sourceCode":"class IterationScheduler:\n    \"\"\"Drives a hypothesis queue across N parallel asyncio slots with UCB picking.\"\"\"\n\n    def __init__(\n        self,\n        runner: Runner,\n        slots: int = 3,\n        max_experiments: int = 50,\n        max_seconds: float = 30.0,\n        exploration_c: float = math.sqrt(2.0),\n        paper_threshold: float = 0.7,\n        prune_floor: float = 0.2,\n        prune_after_runs: int = 3,\n        expander: Expander | None = None,\n    ) -> None:\n        if slots < 1:\n            raise ValueError(\"slots must be >= 1\")\n        if max_experiments < 1:\n            raise ValueError(\"max_experiments must be >= 1\")\n        self.runner = runner\n        self.slots = slots\n        self.max_experiments = max_experiments\n        self.max_seconds = max_seconds\n        self.exploration_c = exploration_c\n        self.paper_threshold = paper_threshold\n        self.prune_floor = prune_floor\n        self.prune_after_runs = prune_after_runs\n        self.expander = expander\n\n    def _pick_next(self, queue: list[Hypothesis], stats: dict[str, BranchStats]) -> int | None:\n        best_idx: int | None = None\n        best_score = -float(\"inf\")\n        total_runs = sum(s.runs for s in stats.values())\n        for idx, hyp in enumerate(queue):\n            bs = stats.get(hyp.branch)\n            if bs is not None and bs.pruned:\n                continue","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/56-iteration-scheduler/code/main.py#L114-L150","documentation":"Error \"max_experiments must be >= 1\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/56-iteration-scheduler/code/main.py:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}