You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plugin.copilot: strict schema decode crashes with "Missing key" when a Copilot model lacks max_context_window_tokens #30909
The plugin.copilot service fails to fetch the Copilot models list and logs an ERROR in every session because the API response contains at least one model (consistently at array index 15) whose capabilities.limits object does not include max_context_window_tokens. The Effect schema decoder treats this as a hard error rather than handling the missing field gracefully.
Repeated in every session, multiple times per minute:
ERROR service=plugin.copilot error=Missing key
at ["data"][15]["capabilities"]["limits"]["max_context_window_tokens"]
failed to fetch copilot models
The error is always at the same path ["data"][15], pointing to a specific model in the GitHub Copilot models API response that does not expose max_context_window_tokens.
Root cause hypothesis
The OpenCode Copilot plugin decodes the GitHub Copilot models API response (GET https://api.githubcopilot.com/models or equivalent) using an Effect Schema that requires capabilities.limits.max_context_window_tokens to be present on every model. GitHub appears to have added (or always had) at least one model entry that omits this field.
The fix should be to mark the field as optional in the schema, e.g.:
// current (strict — breaks on missing field)
max_context_window_tokens: Schema.Number// proposed (tolerant)
max_context_window_tokens: Schema.optional(Schema.Number)
Impact
The entire Copilot models list fails to load every time the field is missing, meaning no Copilot models are available until the next retry.
The error floods the server log on every session.
Present since at least v1.15.13; still present in v1.16.0.
Steps to reproduce
Configure OpenCode with a GitHub Copilot provider.
Open any session.
Inspect server logs — observe repeated Missing key at ["data"][15]["capabilities"]["limits"]["max_context_window_tokens"] failed to fetch copilot models.
Expected behaviour
Models that lack max_context_window_tokens should be decoded successfully (field treated as optional / defaulted to undefined or a sensible fallback), and the rest of the models list should load normally.
Activity
github-actions commentedon Aug 5, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.