rohitg00/ai-engineering-from-scratch · error · ProtocolViolation
task result pollIntervalMs must be a non-negative integer
Error message
task result pollIntervalMs must be a non-negative integer
What it means
Error "task result pollIntervalMs must be a non-negative integer" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py:323
raise ProtocolViolation("task result is valid only for tools/call")
required_strings = ("taskId", "status", "createdAt", "lastUpdatedAt")
for field in required_strings:
if not isinstance(result.get(field), str) or not result[field]:
raise ProtocolViolation(f"task result requires non-empty {field}")
if result["status"] not in {"working", "input_required", "completed", "cancelled", "failed"}:
raise ProtocolViolation("task result has an unknown status")
if "ttlMs" not in result:
raise ProtocolViolation("task result requires ttlMs")
ttl_ms = result["ttlMs"]
if ttl_ms is not None and (
isinstance(ttl_ms, bool) or not isinstance(ttl_ms, int) or ttl_ms < 0
):
raise ProtocolViolation("task result ttlMs must be null or a non-negative integer")
poll_interval = result.get("pollIntervalMs")
if poll_interval is not None and (
isinstance(poll_interval, bool) or not isinstance(poll_interval, int) or poll_interval < 0
):
raise ProtocolViolation("task result pollIntervalMs must be a non-negative integer")
def select_era(
observation: dict[str, Any],
policy: str,
legacy_allowed: bool = False,
legacy_evidence: dict[str, Any] | None = None,
) -> str:
if policy not in {"strict", "fallback"}:
raise ValueError("policy must be strict or fallback")
kind = observation.get("kind")
if kind == "discover_success":
return "modern"
if kind == "jsonrpc_error" and observation.get("code") in MODERN_ERROR_CODES:
return "modern"
if policy == "strict":
raise ProtocolViolation("modern support was not proven; strict policy forbids fallback")
if kind not in {"empty", "timeout", "connection_closed", "unrecognized"}:View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py:323 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/14983f59fc119da0.
Report an issue: GitHub.