question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.io.EOFException at okio.RealBufferedSource.require(RealBufferedSource.java:60) when body is empty when 404 error status

See original GitHub issue

Dear community! Could you please help me with my bug? There is response, request and an exception in logs below. I expect 404 code response but my tests failed because of weird exception. I replaced url and token in logs with dummy values. logs:

Oct 10, 2017 7:09:47 PM okhttp3.internal.platform.Platform log
INFO: --> GET https://tttp.com/rs/api/uw/uwUrl?adminSystemId=sdkhgskdjg&programId=12345
Oct 10, 2017 7:09:47 PM okhttp3.internal.platform.Platform log
INFO: Cookie: wdp-initial-auth=false; LtpaToken2=ttoken; Path=/; HttpOnly
Oct 10, 2017 7:09:47 PM okhttp3.internal.platform.Platform log
INFO: --> END GET
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: <-- 404 Not Found https://tttp.com/rs/api/uw/uwrUrl?adminSystemId=sdkhgskdjg&programId=12345 (393ms)
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: X-Backside-Transport: FAIL FAIL
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: Connection: Keep-Alive
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: Transfer-Encoding: chunked
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: Cache-Control: no-store, no-cache, must-revalidate
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: Content-Language: en-US
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: Date: Tue, 10 Oct 2017 16:09:47 GMT
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: Expires: Mon, 09 Oct 2017 16:09:48 GMT
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: Pragma: no-cache
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: X-Powered-By: Servlet/3.1
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: X-Vcap-Request-Id: ef703926-b9d0-4e30-78e2-861345450103
Oct 10, 2017 7:09:48 PM okhttp3.internal.platform.Platform log
INFO: X-Global-Transaction-ID: 0344791159dcf0cc375654d1

java.io.EOFException
at okio.RealBufferedSource.require(RealBufferedSource.java:60)
  at okio.GzipSource.consumeHeader(GzipSource.java:114)
  at okio.GzipSource.read(GzipSource.java:73)
  at okio.RealBufferedSource.request(RealBufferedSource.java:67)
  at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:240)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
  at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
  at okhttp3.RealCall.execute(RealCall.java:69)
  at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
swankjessecommented, Nov 25, 2018

The content-encoding is not Gzip because it doesn’t have the required 10-byte Gzip header.

0reactions
yschimkecommented, Mar 31, 2022

@kngmat004 you should report the problem to whoever hosts the server. If it’s the same as above it’s a bug.

If you really need to handle it in the client, because the server can’t be fixed, consider using a network interceptor to change headers to work around it.

If you think it’s a bug in OkHttp please provide a reproducible example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

okhttp3: websocket - java.io.EOFException: null - Stack Overflow
In my build.gradle: "com.squareup.okhttp3:okhttp:3.13.1", 'com.squareup.okhttp3:logging-interceptor:3.13.1',.
Read more >
How to Return 404 with Spring WebFlux - Baeldung
Learn how to return 404 status code in Spring WebFlux.
Read more >
Retrofit2: Java.Io.Eofexception Even When Postman Works Fine
Retrofit2: Java.Io.Eofexception Even When Postman Works Fine ... .require(RealBufferedSource.java:60) when body is empty when 404 error status #3646.
Read more >
Error when sending data to API from NiFi - Cloudera Community
I am attempting to sent a POST request to a PowerBI web API. ... RealBufferedSource.require(RealBufferedSource.java:64) ~[okio-1.6.0.jar:na] ...
Read more >
EOF Exception in InvokeHttp when body's response is empty
Description A POST to an API that returns an empty body on success (status code 200) will generate an EOF Exception, causing the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found