#image_generate tool returns gzip-compressed binary instead of JSON, causing parse error

1 messages · Page 1 of 1 (latest)

dim jasper
#

Every call to the image_generate tool fails with a JSON parse error. The response appears to be gzip-compressed binary data that OpenClaw's tool handler is not decompressing before attempting to parse as JSON.

undone stoneBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

dire fernBOT
#

That sounds like a real bug, or at least a bad provider/proxy interaction. OpenClaw’s image generation path currently does await response.json() after the provider HTTP request, so normal Content-Encoding: gzip should be decompressed by Node/undici before JSON parsing. If the parse error is showing gzip magic bytes (1f 8b / �\u001f�\b), the most likely causes are:

  • the upstream/proxy is returning gzipped JSON without a Content-Encoding: gzip header, or
  • there’s a regression in the guarded/provider HTTP fetch path for your environment.

First thing: what does openclaw --version show, and which image provider/model is configured? If you can share the redacted failing log line from openclaw logs --follow, that’ll help confirm whether this is official OpenAI vs a proxy/OpenAI-compatible endpoint.

Possible workaround if you’re using a custom provider/proxy: force uncompressed responses for that provider with a request header like Accept-Encoding: identity under models.providers.<provider>.request.headers. The provider request config supports extra headers there: https://docs.openclaw.ai/gateway/config-tools#model-providers

If this reproduces on latest with the official OpenAI image endpoint, please file it here with version + provider/model + redacted error: https://github.com/openclaw/openclaw/issues

dim jasper
#

OpenClaw 2026.5.7 (eeef486)
google/gemini-3.1-flash-image-preview