rohitg00/ai-engineering-from-scratch · error · ValueError
workflow root must be an object
Error message
workflow root must be an object
What it means
Error "workflow root must be an object" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at certifications/claude/lessons/07-workflow-design-and-human-handoffs/code/main.py:69
errors.append("handoff.checksFailed must be a list")
actions = handoff.get("actionsAvailable")
if not isinstance(actions, list) or not {"approve", "revise", "reject", "escalate"} <= set(actions):
errors.append("handoff must expose approve, revise, reject, and escalate")
return errors
def next_action(workflow: dict[str, Any]) -> dict[str, Any]:
errors = validate_workflow(workflow)
if errors:
raise ValueError("; ".join(errors))
handoff = workflow["handoff"]
return {"decisionRequired": handoff["decisionRequired"], "failedChecks": handoff["checksFailed"], "recommendedAction": "escalate" if handoff["checksFailed"] else "approve", "fallback": handoff["fallback"]}
def load_workflow(path: Path) -> dict[str, Any]:
value = json.loads(path.read_text(encoding="utf-8"))
if not isinstance(value, dict):
raise ValueError("workflow root must be an object")
return value
if __name__ == "__main__":
path = Path(__file__).parents[1] / "outputs" / "workflow-handoff-packet.json"
workflow = load_workflow(path)
print(json.dumps({"valid": not validate_workflow(workflow), "next": next_action(workflow)}, indent=2))
View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at certifications/claude/lessons/07-workflow-design-and-human-handoffs/code/main.py:69 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/e6ae112939767635.
Report an issue: GitHub.