can1357/oh-my-pi · error · ValueError
ready.supportedProtocolVersions must be integers
Error message
ready.supportedProtocolVersions must be integers
What it means
When parsing a ReadyEvent, supportedProtocolVersions must be a JSON list of integers. The check explicitly rejects bools (a bool is an int in Python) and non-int members, raising ValueError if any element fails, because version negotiation depends on real integer protocol versions.
Source
Thrown at python/omp-rpc/src/omp_rpc/protocol.py:1633
def parse_extension_error(payload: JsonObject) -> ExtensionError:
return ExtensionError(
extension_path=_require_str(payload, "extensionPath"),
event=_require_str(payload, "event"),
error=_require_str(payload, "error"),
)
def parse_notification(payload: JsonObject) -> RpcNotification:
event_type = payload.get("type")
if event_type == "ready":
raw_versions = payload.get("supportedProtocolVersions")
supported_versions: tuple[int, ...] | None = None
if raw_versions is not None:
if not isinstance(raw_versions, list) or any(
not isinstance(version, int) or isinstance(version, bool)
for version in raw_versions
):
raise ValueError("ready.supportedProtocolVersions must be integers")
supported_versions = tuple(raw_versions)
return ReadyEvent(
protocol_version=_optional_int(payload, "protocolVersion"),
supported_protocol_versions=supported_versions,
max_frame_bytes=_optional_int(payload, "maxFrameBytes"),
max_reassembled_frame_bytes=_optional_int(
payload, "maxReassembledFrameBytes"
),
)
if event_type == "extension_ui_request":
return parse_extension_ui_request(payload)
if event_type == "extension_error":
return parse_extension_error(payload)
if event_type == "agent_start":
return AgentStartEvent()
if event_type == "agent_end":
return AgentEndEvent(
messages=parse_agent_messages(View on GitHub (pinned to 9690622007)
Solutions
- Fix the server to emit an array of plain integers, e.g. [1, 2].
- Ensure versions are serialized as JSON numbers, not quoted strings.
- Verify no encoder converts ints to floats/bools during serialization.
- Check client/server protocol versions are compatible.
Example fix
// before
{"ready": {"supportedProtocolVersions": ["1", "2"]}}
// after
{"ready": {"supportedProtocolVersions": [1, 2]}} Defensive patterns
Strategy: validation
Validate before calling
versions = ready.get("supportedProtocolVersions")
if versions is not None and not (isinstance(versions, list) and all(isinstance(v, int) and not isinstance(v, bool) for v in versions)):
raise TypeError("supportedProtocolVersions must be a list of integers") Type guard
def is_valid_version_list(ready: dict) -> bool:
versions = ready.get("supportedProtocolVersions")
return versions is None or (isinstance(versions, list) and all(type(v) is int for v in versions)) Try / catch
try:
ready = parse_ready_event(payload)
except ValueError as exc:
raise ProtocolError(f"bad handshake: {payload!r}") from exc Prevention
- Serialize protocol versions as JSON numbers, never strings or floats.
- Remember bool is a subclass of int in Python — use type(v) is int in your own checks.
- Add a handshake integration test between client and server.
When it happens
Trigger: A server sends ready.supportedProtocolVersions as strings (e.g. ["1", "2"]), floats, booleans, a single int instead of a list, or a non-list container like a dict.
Common situations: Server implementations serializing versions as strings; JSON encoders emitting 1.0 instead of 1; a naive bool used as a version flag; protocol handshake changes after a server upgrade.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- tasks must be a list
- cycle_model response did not include a model
- RPC chunk received before protocol negotiation
- RPC frame must be a JSON object
- Replacement text is not valid UTF-8: {err}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/4716da8c429ab59b.
Report an issue: GitHub.