The do() method in internal/client/eightsleep.go sets Accept-Encoding: gzip (line 284) but never decompresses the response body. Since the header is set explicitly, Go's http.Client does not auto-decompress. This causes invalid character '\x1f' looking for beginning of value errors on most endpoints (device info, metrics intervals, status, etc.).
$ eightctl device info --quiet
Error: invalid character '\x1f' looking for beginning of value
Fix: Check resp.Header.Get("Content-Encoding") == "gzip" and wrap resp.Body with gzip.NewReader() before decoding:
var respBody io.Reader = resp.Body
if resp.Header.Get("Content-Encoding") == "gzip" {
gr, err := gzip.NewReader(resp.Body)
if err == nil {
defer gr.Close()
respBody = gr
}
}
Then use respBody instead of resp.Body for io.ReadAll and json.NewDecoder calls in the same function.
Environment
- Go 1.25.6, Linux x86_64
- eightctl built from latest
main (Feb 2026)
The
do()method ininternal/client/eightsleep.gosetsAccept-Encoding: gzip(line 284) but never decompresses the response body. Since the header is set explicitly, Go'shttp.Clientdoes not auto-decompress. This causesinvalid character '\x1f' looking for beginning of valueerrors on most endpoints (device info,metrics intervals,status, etc.).Fix: Check
resp.Header.Get("Content-Encoding") == "gzip"and wrapresp.Bodywithgzip.NewReader()before decoding:Then use
respBodyinstead ofresp.Bodyforio.ReadAllandjson.NewDecodercalls in the same function.Environment
main(Feb 2026)