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

fixture {f.id} has empty prompt

Error message

fixture {f.id} has empty prompt

What it means

Error "fixture {f.id} has empty prompt" thrown in rohitg00/ai-engineering-from-scratch.

Source

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

                    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}")

    def all(self) -> list[Fixture]:
        return list(self._records)

    def by_category(self) -> dict[str, list[Fixture]]:
        grouped: dict[str, list[Fixture]] = {c: [] for c in CATEGORIES}

View on GitHub (pinned to 39ea8a1c6d)

When it happens

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