openclaw - 💡(How to fix) Fix github-copilot plugin fails with gzip-encoded responses — JSON parse error on all model calls

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

All requests to github-copilot/* models fail with a JSON parse error. The Copilot API returns Content-Encoding: gzip responses, but the plugin attempts to JSON-parse the raw compressed bytes without decompressing first. Auth is completing correctly — the device flow succeeds and stores a valid ghu_* GitHub OAuth user token. The plugin reaches the Copilot API. The failure occurs when parsing the response.

Error Message

All requests to github-copilot/* models fail with a JSON parse error. The Copilot API returns Content-Encoding: gzip responses, but the plugin attempts to JSON-parse the raw compressed bytes without decompressing first. Auth is completing correctly — the device flow succeeds and stores a valid ghu_* GitHub OAuth user token. The plugin reaches the Copilot API. The failure occurs when parsing the response. 3. Request fails immediately with JSON parse error Parse failure on gzip-encoded response body. All github-copilot/* models are unusable. Error from logs:

Root Cause

All requests to github-copilot/* models fail with a JSON parse error. The Copilot API returns Content-Encoding: gzip responses, but the plugin attempts to JSON-parse the raw compressed bytes without decompressing first. Auth is completing correctly — the device flow succeeds and stores a valid ghu_* GitHub OAuth user token. The plugin reaches the Copilot API. The failure occurs when parsing the response.

Fix Action

Fix / Workaround

High — all github-copilot/* models are completely unusable after successful auth. No workaround available without an OpenClaw update.

Code Example

Gateway log evidence showing progression of failures:

Phase 1Before device flow (PAT token, hard auth failure):
  12:34 - github-copilot/o3        → HTTP 403 (Copilot token exchange failed)
  12:34 - github-copilot/gpt-4.1HTTP 403 (Copilot token exchange failed)
  12:34 - github-copilot/gpt-4.1-mini → HTTP 403

Phase 2After device flow (ghu_* OAuth token, auth succeeds but response parse fails):
  16:08 - github-copilot/gpt-4.1Unexpected token '\u001f', "\u001f\ufffd\b\u0000..." is not valid JSON
  16:08 - github-copilot/claude-opus-4.7Unexpected token '\u001f', "\u001f\ufffd\b\u0000..." is not valid JSON
  16:08 - github-copilot/gpt-4.1Unexpected token '\u001f', "\u001f\ufffd\b\u0000..." is not valid JSON
  16:12 - github-copilot/gpt-4.1Unexpected token '\u001f', "\u001f\ufffd\b\u0000..." is not valid JSON

The \u001f\ufffd\u0008 byte sequence is the gzip magic header (0x1F 0x8B 0x08).

Phase 2 confirms the device flow auth is working correctly — the token exchange reaches the Copilot API — but the response body is gzip-compressed and the plugin does not decompress it before JSON.parse().
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

All requests to github-copilot/* models fail with a JSON parse error. The Copilot API returns Content-Encoding: gzip responses, but the plugin attempts to JSON-parse the raw compressed bytes without decompressing first. Auth is completing correctly — the device flow succeeds and stores a valid ghu_* GitHub OAuth user token. The plugin reaches the Copilot API. The failure occurs when parsing the response.

Steps to reproduce

  1. Authenticate via openclaw models auth login-github-copilot (device flow completes successfully, ghu_* token stored as github-copilot:github)
  2. Run any agent turn targeting a github-copilot/* model (tested: gpt-4.1, gpt-4.1-mini, claude-opus-4.7, o3, o4-mini)
  3. Request fails immediately with JSON parse error

Expected behavior

Successful model response from the requested github-copilot/* model

Actual behavior

Parse failure on gzip-encoded response body. All github-copilot/* models are unusable. Error from logs:

GatewayClientRequestError: FailoverError: Unexpected token '\u001f', "\u001f\ufffd\b\u0000\u0000\u0000\u0000\u0000\u0000\u0003"... is not valid JSON status: 401, reason: auth

The byte sequence \u001f\ufffd\u0008 is the gzip magic header (0x1F 0x8B 0x08), confirming the response body is gzip-compressed JSON that is not being decompressed before parsing.

OpenClaw version

2026.5.12

Operating system

macOS 26.5 (arm64)

Install method

npm global

Model

github-copilot/gpt-4.1, github-copilot/claude-opus-4.7, github-copilot/o3, github-copilot/o4-mini, github-copilot/gpt-4.1-mini

Provider / routing chain

github-copilot (device flow auth, ghu_* token)

Additional provider/model setup details

Account type: GitHub Copilot for Business (Microsoft Corporate account). Node: v26.0.0. Plugin enabled via plugins.entries.github-copilot. Auth profile github-copilot:github confirmed present with type=token and ghu_* token from device flow.

Logs, screenshots, and evidence

Gateway log evidence showing progression of failures:

Phase 1 — Before device flow (PAT token, hard auth failure):
  12:34 - github-copilot/o3        → HTTP 403 (Copilot token exchange failed)
  12:34 - github-copilot/gpt-4.1   → HTTP 403 (Copilot token exchange failed)
  12:34 - github-copilot/gpt-4.1-mini → HTTP 403

Phase 2 — After device flow (ghu_* OAuth token, auth succeeds but response parse fails):
  16:08 - github-copilot/gpt-4.1      → Unexpected token '\u001f', "\u001f\ufffd\b\u0000..." is not valid JSON
  16:08 - github-copilot/claude-opus-4.7 → Unexpected token '\u001f', "\u001f\ufffd\b\u0000..." is not valid JSON
  16:08 - github-copilot/gpt-4.1      → Unexpected token '\u001f', "\u001f\ufffd\b\u0000..." is not valid JSON
  16:12 - github-copilot/gpt-4.1      → Unexpected token '\u001f', "\u001f\ufffd\b\u0000..." is not valid JSON

The \u001f\ufffd\u0008 byte sequence is the gzip magic header (0x1F 0x8B 0x08).

Phase 2 confirms the device flow auth is working correctly — the token exchange reaches the Copilot API — but the response body is gzip-compressed and the plugin does not decompress it before JSON.parse().

Impact and severity

High — all github-copilot/* models are completely unusable after successful auth. No workaround available without an OpenClaw update.

Additional information

Suggested fix: The Copilot token exchange HTTP client and/or model call response handler should either:

  1. Decompress gzip/brotli responses before parsing (e.g. Node's zlib.gunzipSync or pipe through zlib.createGunzip())
  2. OR send Accept-Encoding: identity on Copilot API requests to opt out of compression entirely — simpler and less invasive, guarantees plain JSON responses without touching the response pipeline.

Option 2 is the recommended minimal fix.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Successful model response from the requested github-copilot/* model

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix github-copilot plugin fails with gzip-encoded responses — JSON parse error on all model calls