Closed HydroPage closed 3 years ago
Could you please provide actual logs instead of images?
This was a while ago, and it’s very rare to occur. I can’t reproduce it
On Wed, Mar 31, 2021 at 6:54 AM OskarZyg @.***> wrote:
Could you please provide actual logs instead of images?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HypixelDev/PublicAPI/issues/386#issuecomment-811005288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHQUR4SVZFCWWESPE3OTG2DTGMEP3ANCNFSM4XFIG7KQ .
Something related to an unstable connection I guess.
Well, yes, that’s an easy guess. I just thought I’d point out that it does happen so maybe they can consider wrapping it
On Wed, Mar 31, 2021 at 7:40 AM OskarZyg @.***> wrote:
Something related to an unstable connection I guess.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HypixelDev/PublicAPI/issues/386#issuecomment-811036483, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHQUR4R74LEHAR47X7DIV33TGMJ4VANCNFSM4XFIG7KQ .
It's a syntax error, so if I had to guess, I would say it's cloudflare messing with stuff by returning html page
For the past couple of hours today, this error has rendered my program completely useless. I changed nothing about my code which was working before, and now this same error keeps on occurring and occurring. I really would like to know what the real cause is.
First reply asked for a real log, so here is a sample
java.util.concurrent.CompletionException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:632)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
at net.hypixel.api.HypixelAPI.lambda$get$1(HypixelAPI.java:262)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:187)
at com.google.gson.Gson.fromJson(Gson.java:805)
at com.google.gson.Gson.fromJson(Gson.java:770)
at com.google.gson.Gson.fromJson(Gson.java:719)
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.Gson.fromJson(Gson.java:691)
at net.hypixel.api.HypixelAPI.lambda$null$0(HypixelAPI.java:254)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139)
at net.hypixel.api.HypixelAPI.lambda$get$1(HypixelAPI.java:249)
... 5 common frames omitted
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:387)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
... 14 common frames omitted
For the past couple of hours today, this error has rendered my program completely useless. I changed nothing about my code which was working before, and now this same error keeps on occurring and occurring. I really would like to know what the real cause is.
First reply asked for a real log, so here is a sample
java.util.concurrent.CompletionException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346) at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:632) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506) at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088) at net.hypixel.api.HypixelAPI.lambda$get$1(HypixelAPI.java:262) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:187) at com.google.gson.Gson.fromJson(Gson.java:805) at com.google.gson.Gson.fromJson(Gson.java:770) at com.google.gson.Gson.fromJson(Gson.java:719) Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ at com.google.gson.Gson.fromJson(Gson.java:691) at net.hypixel.api.HypixelAPI.lambda$null$0(HypixelAPI.java:254) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139) at net.hypixel.api.HypixelAPI.lambda$get$1(HypixelAPI.java:249) ... 5 common frames omitted Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:387) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ ... 14 common frames omitted
It’s because there is API issues rn where API returns Error 502 Bad Gateway on a significant amount of requests and serves an HTML page.
Hopefully it gets fixed soon, however there is no issue created about this :/
returns Error 502 Bad Gateway on a significant amount of requests
I did some testing, and my application is one that has to make a lot of requests in bulk. 300 or 400 requests over the span of a few minutes. I did some experimenting, and noticed that after a few hundred ish requests, this error happened. But it was way worse one or two days ago, it's becoming less chronic. Very annoying though, since my application is not fault tolerant to this error
The exception itself (as people have pointed out) happens when the API is having issues and instead returns a non-json response, usually a Cloudflare error page. Hopefully, after recent changes to scale the service the issue should happen very infrequently now.
Using release 3.0.0