{"record":{"id":"ac768ea76e243a2d","repo":"github/copilot-sdk","slug":"missing-required-fields-in-getstatusresponse-vers","errorCode":null,"errorMessage":"Missing required fields in GetStatusResponse: version={version}, protocolVersion={protocol_version}","messagePattern":"Missing required fields in GetStatusResponse: version=(.+?), protocolVersion=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/copilot/client.py","lineNumber":904,"sourceCode":"        result: dict = {}\n        result[\"message\"] = self.message\n        return result\n\n\n@dataclass\nclass GetStatusResponse:\n    \"\"\"Response from status.get\"\"\"\n\n    version: str  # Package version (e.g., \"1.0.0\")\n    protocol_version: int  # Protocol version for SDK compatibility\n\n    @staticmethod\n    def from_dict(obj: Any) -> GetStatusResponse:\n        assert isinstance(obj, dict)\n        version = obj.get(\"version\")\n        protocol_version = obj.get(\"protocolVersion\")\n        if version is None or protocol_version is None:\n            raise ValueError(\n                f\"Missing required fields in GetStatusResponse: version={version}, \"\n                f\"protocolVersion={protocol_version}\"\n            )\n        return GetStatusResponse(str(version), int(protocol_version))\n\n    def to_dict(self) -> dict:\n        result: dict = {}\n        result[\"version\"] = self.version\n        result[\"protocolVersion\"] = self.protocol_version\n        return result\n\n\n@dataclass\nclass GetAuthStatusResponse:\n    \"\"\"Response from auth.getStatus\"\"\"\n\n    isAuthenticated: bool  # Whether the user is authenticated\n    authType: str | None = None  # Authentication type","sourceCodeStart":886,"sourceCodeEnd":922,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/client.py#L886-L922","documentation":"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.","triggerScenarios":"Server returns a status object missing 'version' or 'protocolVersion'; a health endpoint/proxy returns a reduced payload; mocks return only {'version': ...}.","commonSituations":"Older or heavily proxied server deployments stripping fields; status served by a custom shim; testing with hand-written fixture JSON that omits protocolVersion.","solutions":["Ensure the server's getStatus response includes both 'version' and 'protocolVersion' (upgrade server if needed)","Update test fixtures/mocks to include both fields","Check any proxy/gateway that might rewrite the status response"],"exampleFix":"// before (fixture)\n{\"version\": \"1.2.3\"}\n// after\n{\"version\": \"1.2.3\", \"protocolVersion\": 1}","handlingStrategy":"type-guard","validationCode":"def has_status_fields(obj) -> bool:\n    return isinstance(obj, dict) and obj.get(\"version\") is not None and obj.get(\"protocolVersion\") is not None","typeGuard":"def is_status_payload(obj: object) -> bool:\n    return isinstance(obj, dict) and \"version\" in obj and \"protocolVersion\" in obj","tryCatchPattern":"try:\n    status = GetStatusResponse.from_dict(payload)\nexcept ValueError as e:\n    if str(e).startswith(\"Missing required fields in GetStatusResponse\"):\n        logger.error(\"incomplete status payload: %s\", payload)\n        status = None\n    else:\n        raise","preventionTips":["Check proxies/gateways don't strip status fields","Keep protocol-version fixtures current with the server build","Validate status JSON before decoding"],"tags":["python","deserialization","status","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}