github/copilot-sdk · error · ValueError

Missing required fields in GetStatusResponse: version=

Error message

Missing required fields in GetStatusResponse: version={version}, protocolVersion={protocol_version}

What it means

GetStatusResponse.from_dict requires both 'version' and 'protocolVersion' in the status payload; if either is missing/None it raises ValueError echoing both values. This ensures the client always has a usable server version and negotiated protocol version.

Solutions

  1. Ensure the server's getStatus response includes both 'version' and 'protocolVersion' (upgrade server if needed)
  2. Update test fixtures/mocks to include both fields
  3. Check any proxy/gateway that might rewrite the status response

Example fix

// before (fixture)
{"version": "1.2.3"}
// after
{"version": "1.2.3", "protocolVersion": 1}
Defensive patterns

Strategy: type-guard

Validate before calling

def has_status_fields(obj) -> bool:
    return isinstance(obj, dict) and obj.get("version") is not None and obj.get("protocolVersion") is not None

Type guard

def is_status_payload(obj: object) -> bool:
    return isinstance(obj, dict) and "version" in obj and "protocolVersion" in obj

Try / catch

try:
    status = GetStatusResponse.from_dict(payload)
except ValueError as e:
    if str(e).startswith("Missing required fields in GetStatusResponse"):
        logger.error("incomplete status payload: %s", payload)
        status = None
    else:
        raise

Prevention

When it happens

Trigger: Server returns a status object missing 'version' or 'protocolVersion'; a health endpoint/proxy returns a reduced payload; mocks return only {'version': ...}.

Common situations: Older or heavily proxied server deployments stripping fields; status served by a custom shim; testing with hand-written fixture JSON that omits protocolVersion.

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


AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/ac768ea76e243a2d. Report an issue: GitHub.

Appendix: source

Thrown at python/copilot/client.py:904

        result: dict = {}
        result["message"] = self.message
        return result


@dataclass
class GetStatusResponse:
    """Response from status.get"""

    version: str  # Package version (e.g., "1.0.0")
    protocol_version: int  # Protocol version for SDK compatibility

    @staticmethod
    def from_dict(obj: Any) -> GetStatusResponse:
        assert isinstance(obj, dict)
        version = obj.get("version")
        protocol_version = obj.get("protocolVersion")
        if version is None or protocol_version is None:
            raise ValueError(
                f"Missing required fields in GetStatusResponse: version={version}, "
                f"protocolVersion={protocol_version}"
            )
        return GetStatusResponse(str(version), int(protocol_version))

    def to_dict(self) -> dict:
        result: dict = {}
        result["version"] = self.version
        result["protocolVersion"] = self.protocol_version
        return result


@dataclass
class GetAuthStatusResponse:
    """Response from auth.getStatus"""

    isAuthenticated: bool  # Whether the user is authenticated
    authType: str | None = None  # Authentication type

View on GitHub (pinned to cd8cf15dc3)