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

threshold must be an integer from 1 through the number of tr

Error message

threshold must be an integer from 1 through the number of trigger terms

What it means

Error "threshold must be an integer from 1 through the number of trigger terms" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/13-tools-and-protocols/27-skill-evals-packaging-and-portability/outputs/skill-release-gate/scripts/evaluate_skill.py:544

                missing.append("companion-files")
            if requirements["scriptExecution"] and not host["runsBundledScripts"]:
                missing.append("script-execution")
            unsupported = set(requirements["runtimeExtensions"]) - set(host["supportedExtensions"])
            missing.extend(f"extension:{name}" for name in sorted(unsupported))
            status = "native" if not missing else "adapter-required"
        rows.append({"host": host["name"], "status": status, "missing": missing})
    return rows


def validate_configuration(
    case_config: dict[str, object], host_config: dict[str, object]
) -> None:
    terms = case_config.get("triggerTerms")
    if not isinstance(terms, list) or not terms or not all(isinstance(term, str) for term in terms):
        raise ValueError("triggerTerms must be a non-empty array of strings")
    threshold = case_config.get("threshold")
    if type(threshold) is not int or not 1 <= threshold <= len(set(terms)):
        raise ValueError("threshold must be an integer from 1 through the number of trigger terms")
    runs = case_config.get("runs")
    if type(runs) is not int or runs < 1:
        raise ValueError("runs must be a positive integer")
    for field in ("minimumPrecision", "minimumRecall", "minimumRepeatRate"):
        value = case_config.get(field)
        if (
            isinstance(value, bool)
            or not isinstance(value, (int, float))
            or not math.isfinite(value)
            or not 0.0 <= value <= 1.0
        ):
            raise ValueError(f"{field} must be a finite number from 0 to 1")
    cases = case_config.get("cases")
    if not isinstance(cases, list) or not cases:
        raise ValueError("cases must be a non-empty array")
    if not all(
        isinstance(case, dict)
        and isinstance(case.get("id"), str)

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/13-tools-and-protocols/27-skill-evals-packaging-and-portability/outputs/skill-release-gate/scripts/evaluate_skill.py:544 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/a1a99d2f5a94f9a7. Report an issue: GitHub.