{"record":{"id":"95581f99ff528a94","repo":"can1357/oh-my-pi","slug":"set-host-uri-schemes-response-did-not-include-sche","errorCode":null,"errorMessage":"set_host_uri_schemes response did not include schemes","messagePattern":"set_host_uri_schemes response did not include schemes","errorType":"exception","errorClass":"RpcError","httpStatus":null,"severity":"error","filePath":"python/omp-rpc/src/omp_rpc/client.py","lineNumber":1134,"sourceCode":"\n        schemes_payload: list[JsonObject] = []\n        for uri in self._host_uris:\n            entry: JsonObject = {\n                \"scheme\": uri.scheme,\n                \"writable\": uri.writable,\n                \"immutable\": uri.immutable,\n            }\n            if uri.description is not None:\n                entry[\"description\"] = uri.description\n            schemes_payload.append(entry)\n\n        payload = self._request(\n            \"set_host_uri_schemes\",\n            schemes=cast(JsonValue, schemes_payload),\n        )\n        schemes = payload.get(\"schemes\") or []\n        if not isinstance(schemes, list):\n            raise RpcError(\"set_host_uri_schemes response did not include schemes\")\n        return tuple(str(entry) for entry in schemes)\n\n    def prompt(\n        self,\n        message: str,\n        *,\n        images: Sequence[ImageContent] | None = None,\n        streaming_behavior: StreamingBehavior | None = None,\n    ) -> None:\n        self._request(\n            \"prompt\",\n            message=message,\n            images=list(images) if images is not None else None,\n            streamingBehavior=streaming_behavior,\n        )\n        self._mark_agent_run_scheduled()\n\n    def steer(","sourceCodeStart":1116,"sourceCodeEnd":1152,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/omp-rpc/src/omp_rpc/client.py#L1116-L1152","documentation":"set_host_uri_schemes() registers custom URI schemes with the server and expects the response to echo them in a 'schemes' list. If payload.get('schemes') is not a list, the client raises this RpcError because callers need the confirmed scheme names. It indicates the server did not perform (or does not support) scheme registration as expected.","triggerScenarios":"Server responds to set_host_uri_schemes without a schemes array — older server builds, servers rejecting the scheme payload (e.g. malformed HostUri entries), or stub servers returning an ack without the field.","commonSituations":"Client/server version skew (field added in a later protocol revision); invalid scheme strings in the HostUri list causing a server-side error payload; mocks that don't implement the command.","solutions":["Upgrade the server so set_host_uri_schemes echoes schemes","Validate HostUri scheme strings before registering (lowercase, RFC-valid scheme syntax)","Align client and server versions","In tests, have the stub return {\"schemes\": [...]} mirroring the request"],"exampleFix":"# before: stub returns nothing useful\nreturn {}\n\n# after\nreturn {\"schemes\": list(requested_schemes)}","handlingStrategy":"try-catch","validationCode":"import re\n_SCHEME = re.compile(r\"^[a-z][a-z0-9+.-]*$\")\nvalid_schemes = [u.scheme for u in host_uris if _SCHEME.match(u.scheme)]\n","typeGuard":"def has_schemes(payload: object) -> bool:\n    schemes = (payload or {}).get(\"schemes\") if isinstance(payload, dict) else None\n    return isinstance(schemes, list)\n","tryCatchPattern":"try:\n    schemes = client.set_host_uri_schemes(host_uris)\nexcept RpcError as e:\n    if \"did not include schemes\" in str(e):\n        schemes = ()  # unsupported server or rejected payload; handle gracefully\n    else:\n        raise\n","preventionTips":["Validate URI scheme strings (lowercase RFC scheme syntax) before registering","Keep client and server versions aligned","Have mocks return {\"schemes\": [...]} mirroring the request","Log the raw response when scheme registration fails"],"tags":["rpc","response-validation","uri-schemes","schema-mismatch"],"backgroundTag":"rpc-response-schema-invalid","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}