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

empty fixture corpus

Error message

empty fixture corpus

What it means

Error "empty fixture corpus" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/19-capstone-projects/82-jailbreak-taxonomy/code/main.py:97

                Fixture(
                    id=str(r["id"]),
                    category=str(r["category"]),
                    subtype=str(r["subtype"]),
                    prompt=str(r["prompt"]),
                    target_behavior=str(r["target_behavior"]),
                    severity=int(r["severity"]),
                )
            )
        self._grams = [(_trigrams(f.prompt), f) for f in self._records]
        self.validate()

    @classmethod
    def from_default(cls) -> "Taxonomy":
        return cls(load_fixtures())

    def validate(self) -> None:
        if not self._records:
            raise ValueError("empty fixture corpus")
        seen_ids: set[str] = set()
        per_cat: defaultdict[str, int] = defaultdict(int)
        for f in self._records:
            if not f.prompt.strip():
                raise ValueError(f"fixture {f.id} has empty prompt")
            if f.id in seen_ids:
                raise ValueError(f"duplicate fixture id: {f.id}")
            seen_ids.add(f.id)
            lo, hi = SEVERITY_RANGE
            if not (lo <= f.severity <= hi):
                raise ValueError(f"fixture {f.id} severity {f.severity} out of {SEVERITY_RANGE}")
            if f.category not in CATEGORIES:
                raise ValueError(f"fixture {f.id} unknown category {f.category}")
            per_cat[f.category] += 1
        for cat in CATEGORIES:
            if per_cat[cat] < MIN_PER_CATEGORY:
                raise ValueError(f"category {cat} has {per_cat[cat]} fixtures, need >= {MIN_PER_CATEGORY}")

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/19-capstone-projects/82-jailbreak-taxonomy/code/main.py:97 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/636b5eb72277e2ff. Report an issue: GitHub.