rohitg00/ai-engineering-from-scratch · error · ValueError
; ".join(errors)
Error message
; ".join(errors)
What it means
Error "; ".join(errors)" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at certifications/claude/lessons/12-claude-agent-sdk-and-hooks/code/main.py:219
errors.append("computerUse network allowlist cannot be empty")
if not isinstance(display, dict) or any(
not isinstance(display.get(field), int) or isinstance(display[field], bool) or display[field] <= 0
for field in ("width", "height")
):
errors.append("computerUse display dimensions must be positive integers")
if computer.get("requireFreshScreenshotBeforeAction") is not True or computer.get("requireScreenshotAfterAction") is not True:
errors.append("computerUse requires screenshots before and after actions")
if not isinstance(computer.get("allowedActions"), list) or "screenshot" not in computer["allowedActions"]:
errors.append("computerUse needs an explicit action allowlist")
if not isinstance(approval, dict) or not REQUIRED_APPROVAL_RISKS <= set(approval.get("requiredRiskClasses", [])) or "credential-entry" not in set(approval.get("deniedRiskClasses", [])):
errors.append("computerUse needs approval and denial risk boundaries")
return errors
def evaluate_action(policy: dict[str, Any], tool_name: str, approved: bool) -> dict[str, Any]:
errors = validate_policy(policy)
if errors:
raise ValueError("; ".join(errors))
tool = next((item for item in policy["tools"] if item["name"] == tool_name), None)
if tool is None:
return {"allowed": False, "reason": "unknown tool"}
if tool.get("approvalPolicy") == "per-action":
return {"allowed": False, "reason": "per-action policy required"}
if tool["approvalRequired"] and not approved:
return {"allowed": False, "reason": "approval required"}
return {"allowed": True, "reason": "policy and approval passed"}
class ComputerUseGuard:
"""Validate model-proposed UI actions against trusted harness state."""
def __init__(self, policy: dict[str, Any]) -> None:
errors = validate_policy(policy)
if errors:
raise ValueError("; ".join(errors))
self.config = policy["computerUse"]View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at certifications/claude/lessons/12-claude-agent-sdk-and-hooks/code/main.py:219 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/be3c20a0d7319e49.
Report an issue: GitHub.