github/copilot-sdk · error · ValueError
Missing required field 'isAuthenticated' in…
Error message
Missing required field 'isAuthenticated' in GetAuthStatusResponse
What it means
GetAuthStatusResponse.from_dict requires the 'isAuthenticated' key in the auth-status payload and raises ValueError when it is absent or None. Optional fields (authType, host, login, statusMessage) are tolerated, but the boolean auth flag is mandatory for decoding.
Solutions
- Ensure the payload contains 'isAuthenticated' (camelCase) before calling from_dict
- Remap alternate key names in an adapter, e.g. obj.setdefault('isAuthenticated', obj.get('authenticated'))
- Upgrade/align the server so the auth-status schema matches the client's expectations
- Fix test fixtures to include isAuthenticated
Example fix
// before
resp = GetAuthStatusResponse.from_dict({"authType": "oauth"})
// after
payload = {"authType": "oauth", "isAuthenticated": False}
resp = GetAuthStatusResponse.from_dict(payload) Defensive patterns
Strategy: type-guard
Validate before calling
def has_auth_flag(obj) -> bool:
return isinstance(obj, dict) and obj.get("isAuthenticated") is not None Type guard
def is_auth_status_payload(obj: object) -> bool:
return isinstance(obj, dict) and "isAuthenticated" in obj Try / catch
try:
auth = GetAuthStatusResponse.from_dict(payload)
except ValueError as e:
if "Missing required field 'isAuthenticated'" in str(e):
payload.setdefault("isAuthenticated", payload.get("authenticated", False))
auth = GetAuthStatusResponse.from_dict(payload)
else:
raise Prevention
- Watch for snake_case/camelCase key renames in middleware
- Keep auth-status fixtures in sync with the server schema
- Treat optional fields (authType, host, login) as such; only rely on isAuthenticated
When it happens
Trigger: Server/proxy returns auth status without 'isAuthenticated'; a payload uses a different key like 'authenticated' or nests it under 'status'; mocks omit the field.
Common situations: Custom auth middleware reshaping the response; older server builds with a different auth-status schema; hand-written test fixtures; key-casing mismatches after JSON transformations.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Missing required fields in PingResponse: message=
- Missing required field 'message' in StopError
- Missing required fields in GetStatusResponse: version=
- Missing required fields in ModelPolicy: state=
- Missing required fields in ModelInfo: id=
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/80bef0d20cdf4863.
Report an issue: GitHub.
Appendix: source
Thrown at python/copilot/client.py:932
return result
@dataclass
class GetAuthStatusResponse:
"""Response from auth.getStatus"""
isAuthenticated: bool # Whether the user is authenticated
authType: str | None = None # Authentication type
host: str | None = None # GitHub host URL
login: str | None = None # User login name
statusMessage: str | None = None # Human-readable status message
@staticmethod
def from_dict(obj: Any) -> GetAuthStatusResponse:
assert isinstance(obj, dict)
isAuthenticated = obj.get("isAuthenticated")
if isAuthenticated is None:
raise ValueError("Missing required field 'isAuthenticated' in GetAuthStatusResponse")
authType = obj.get("authType")
host = obj.get("host")
login = obj.get("login")
statusMessage = obj.get("statusMessage")
return GetAuthStatusResponse(
isAuthenticated=bool(isAuthenticated),
authType=authType,
host=host,
login=login,
statusMessage=statusMessage,
)
def to_dict(self) -> dict:
result: dict = {}
result["isAuthenticated"] = self.isAuthenticated
if self.authType is not None:
result["authType"] = self.authType
if self.host is not None:View on GitHub (pinned to cd8cf15dc3)