rohitg00/ai-engineering-from-scratch · error · ValueError
record root must be an object
Error message
record root must be an object
What it means
Error "record root must be an object" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at certifications/claude/lessons/01-claude-product-and-model-landscape/code/main.py:209
return isinstance(value, str) and value.startswith(OFFICIAL_DOC_PREFIXES)
def _nonempty_strings(value: Any) -> bool:
return isinstance(value, list) and bool(value) and all(isinstance(item, str) and item.strip() for item in value)
def _iso_date(value: Any) -> bool:
try:
date.fromisoformat(value)
return isinstance(value, str)
except (TypeError, ValueError):
return False
def load_record(path: Path) -> dict[str, Any]:
value = json.loads(path.read_text(encoding="utf-8"))
if not isinstance(value, dict):
raise ValueError("record root must be an object")
return value
if __name__ == "__main__":
path = Path(__file__).parents[1] / "outputs" / "product-selection-record.json"
record = load_record(path)
print(json.dumps({"valid": not validate_record(record), "recommendation": recommend(record)}, indent=2))
View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at certifications/claude/lessons/01-claude-product-and-model-landscape/code/main.py:209 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/3b52ae3745b0bf7f.
Report an issue: GitHub.