can1357/oh-my-pi · error · RpcError

set_host_uri_schemes response did not include schemes

Error message

set_host_uri_schemes response did not include schemes

What it means

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.

Source

Thrown at python/omp-rpc/src/omp_rpc/client.py:1134

        schemes_payload: list[JsonObject] = []
        for uri in self._host_uris:
            entry: JsonObject = {
                "scheme": uri.scheme,
                "writable": uri.writable,
                "immutable": uri.immutable,
            }
            if uri.description is not None:
                entry["description"] = uri.description
            schemes_payload.append(entry)

        payload = self._request(
            "set_host_uri_schemes",
            schemes=cast(JsonValue, schemes_payload),
        )
        schemes = payload.get("schemes") or []
        if not isinstance(schemes, list):
            raise RpcError("set_host_uri_schemes response did not include schemes")
        return tuple(str(entry) for entry in schemes)

    def prompt(
        self,
        message: str,
        *,
        images: Sequence[ImageContent] | None = None,
        streaming_behavior: StreamingBehavior | None = None,
    ) -> None:
        self._request(
            "prompt",
            message=message,
            images=list(images) if images is not None else None,
            streamingBehavior=streaming_behavior,
        )
        self._mark_agent_run_scheduled()

    def steer(

View on GitHub (pinned to 9690622007)

Solutions

  1. Upgrade the server so set_host_uri_schemes echoes schemes
  2. Validate HostUri scheme strings before registering (lowercase, RFC-valid scheme syntax)
  3. Align client and server versions
  4. In tests, have the stub return {"schemes": [...]} mirroring the request

Example fix

# before: stub returns nothing useful
return {}

# after
return {"schemes": list(requested_schemes)}
Defensive patterns

Strategy: try-catch

Validate before calling

import re
_SCHEME = re.compile(r"^[a-z][a-z0-9+.-]*$")
valid_schemes = [u.scheme for u in host_uris if _SCHEME.match(u.scheme)]

Type guard

def has_schemes(payload: object) -> bool:
    schemes = (payload or {}).get("schemes") if isinstance(payload, dict) else None
    return isinstance(schemes, list)

Try / catch

try:
    schemes = client.set_host_uri_schemes(host_uris)
except RpcError as e:
    if "did not include schemes" in str(e):
        schemes = ()  # unsupported server or rejected payload; handle gracefully
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/95581f99ff528a94. Report an issue: GitHub.