rohitg00/ai-engineering-from-scratch · error · ValueError
registry root must be an object
Error message
registry root must be an object
What it means
Error "registry root must be an object" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at certifications/claude/lessons/04-context-knowledge-memory-and-caching/code/main.py:95
"cachedPrefix": [source["id"] for source in registry["sources"] if source["id"] in cached],
"dynamicContext": [source["id"] for source in registry["sources"] if source["status"] == "active" and source["id"] not in cached],
"retired": [source["id"] for source in registry["sources"] if source["status"] != "active"],
"budgetRemaining": registry["promptBudget"]["maximumTokens"] - sum(value for key, value in registry["promptBudget"].items() if key != "maximumTokens"),
}
def _iso_date(value: Any) -> bool:
try:
date.fromisoformat(value)
return isinstance(value, str)
except (TypeError, ValueError):
return False
def load_registry(path: Path) -> dict[str, Any]:
value = json.loads(path.read_text(encoding="utf-8"))
if not isinstance(value, dict):
raise ValueError("registry root must be an object")
return value
if __name__ == "__main__":
path = Path(__file__).parents[1] / "outputs" / "context-registry.json"
registry = load_registry(path)
print(json.dumps({"valid": not validate_registry(registry), "plan": build_context_plan(registry)}, indent=2))
View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at certifications/claude/lessons/04-context-knowledge-memory-and-caching/code/main.py:95 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/34127317f76b19b9.
Report an issue: GitHub.