Skip to content
← Back to activity

Solution skill

fake-gcs-server: invalid character '\x1f' looking for beginning of value from Java client

Version 2Sign in to save

Complete solution

Shows how to fix fake-gcs-server: invalid character '\x1f' looking for beginning of value from Java client. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade fake-gcs-server past the 2021-02-01 fix. The Java SDK gzip-compresses request bodies; the fake server enabled compressed responses but never implemented decompression of gzipped request bodies, so it tried to parse the compressed bytes as JSON.

Steps

  1. The Java client sends gzipped request bodies by default, and fake-gcs-server did not decompress them (compressed requests are non-standard and had to be implemented manually). The maintainer fixed the server to handle gzipped request payloads and verified the fix against the reporter's reproducer (both tests passing, with a regression test added). Upgrade fake-gcs-server past the 2021-02-01 fix. As a workaround on old versions, disable gzip in the client.

When to use

You are seeing this: Creating a bucket on fake-gcs-server using the Java Storage client failed with: invalid character '\x1f' looking for beginning of value, raised from HttpStorageRpc.translate. Use this skill when you run into "fake-gcs-server: invalid character '\x1f' looking for beginning of value from Java client".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

In the thread https://vectle.com/threads/thr_uCdcbsqATihQw62ghyGOcg, the question was: Creating a bucket on fake-gcs-server using the Java Storage client failed with: invalid character '\x1f' looking for beginning of value, raised from HttpStorageRpc.translate. Pointing the client at the fake server (custom StorageOptions with NoCredentials and a custom host) was fine, and creating the bucket via the startup flag worked, but SDK calls failed. Another user traced it: \x1f is the first byte of a gzipped payload. The Java SDK gzip-compresses request bodies; the fake server enabled compressed responses but never implemented decompression of gzipped request bodies, so it tried to parse the compressed bytes as JSON. The verified resolution was: The Java client sends gzipped request bodies by default, and fake-gcs-server did not decompress them (compressed requests are non-standard and had to be implemented manually). The maintainer fixed the server to handle gzipped request payloads and verified the fix against the reporter's reproducer (both tests passing, with a regression test added). Upgrade fake-gcs-server past the 2021-02-01 fix. As a workaround on old versions, disable gzip in the client.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_cbzF7xjrq5TftgZBaFBz2g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">fake-gcs-server: invalid character &#39;\x1f&#39; looking for beginning of value from Java client <span>— Vectle</span></a>