{"record":{"id":"14983f59fc119da0","repo":"rohitg00/ai-engineering-from-scratch","slug":"task-result-pollintervalms-must-be-a-non-negative","errorCode":null,"errorMessage":"task result pollIntervalMs must be a non-negative integer","messagePattern":"task result pollIntervalMs must be a non-negative integer","errorType":"validation","errorClass":"ProtocolViolation","httpStatus":null,"severity":"error","filePath":"phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py","lineNumber":323,"sourceCode":"        raise ProtocolViolation(\"task result is valid only for tools/call\")\n    required_strings = (\"taskId\", \"status\", \"createdAt\", \"lastUpdatedAt\")\n    for field in required_strings:\n        if not isinstance(result.get(field), str) or not result[field]:\n            raise ProtocolViolation(f\"task result requires non-empty {field}\")\n    if result[\"status\"] not in {\"working\", \"input_required\", \"completed\", \"cancelled\", \"failed\"}:\n        raise ProtocolViolation(\"task result has an unknown status\")\n    if \"ttlMs\" not in result:\n        raise ProtocolViolation(\"task result requires ttlMs\")\n    ttl_ms = result[\"ttlMs\"]\n    if ttl_ms is not None and (\n        isinstance(ttl_ms, bool) or not isinstance(ttl_ms, int) or ttl_ms < 0\n    ):\n        raise ProtocolViolation(\"task result ttlMs must be null or a non-negative integer\")\n    poll_interval = result.get(\"pollIntervalMs\")\n    if poll_interval is not None and (\n        isinstance(poll_interval, bool) or not isinstance(poll_interval, int) or poll_interval < 0\n    ):\n        raise ProtocolViolation(\"task result pollIntervalMs must be a non-negative integer\")\n\n\ndef select_era(\n    observation: dict[str, Any],\n    policy: str,\n    legacy_allowed: bool = False,\n    legacy_evidence: dict[str, Any] | None = None,\n) -> str:\n    if policy not in {\"strict\", \"fallback\"}:\n        raise ValueError(\"policy must be strict or fallback\")\n    kind = observation.get(\"kind\")\n    if kind == \"discover_success\":\n        return \"modern\"\n    if kind == \"jsonrpc_error\" and observation.get(\"code\") in MODERN_ERROR_CODES:\n        return \"modern\"\n    if policy == \"strict\":\n        raise ProtocolViolation(\"modern support was not proven; strict policy forbids fallback\")\n    if kind not in {\"empty\", \"timeout\", \"connection_closed\", \"unrecognized\"}:","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py#L305-L341","documentation":"Error \"task result pollIntervalMs must be a non-negative integer\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py:323 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}