AsyncPokemonGoException: Unknown
When I run
go.getInventories().updateInventories();
or
go.getMap().getCatchablePokemon();
I sometimes get this errors, and the entire thing breaks. I have to terminate and rerun. It runs fine for a while until I get the error again.
I'm on commit 626145894534c4e85213eaac4116a5be519b104a.
Here's the error.
com.pokegoapi.exceptions.AsyncPokemonGoException: Unknown exception occurred.
at com.pokegoapi.util.AsyncHelper.toBlocking(AsyncHelper.java:45)
at com.pokegoapi.main.RequestHandler.sendServerRequests(RequestHandler.java:155)
at com.pokegoapi.api.inventory.Inventories.updateInventories(Inventories.java:108)
at com.pokegoapi.api.inventory.Inventories.updateInventories(Inventories.java:84)
at PokePlay.run(PokePlay.java:220)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.pokegoapi.exceptions.RemoteServerException: Got a unexpected http code : 502
at rx.exceptions.Exceptions.propagate(Exceptions.java:58)
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:465)
at rx.observables.BlockingObservable.first(BlockingObservable.java:168)
at com.pokegoapi.util.AsyncHelper.toBlocking(AsyncHelper.java:37)
... 5 more
Caused by: java.util.concurrent.ExecutionException: com.pokegoapi.exceptions.RemoteServerException: Got a unexpected http code : 502
at com.pokegoapi.main.RequestHandler$1.get(RequestHandler.java:109)
at com.pokegoapi.main.RequestHandler$1.get(RequestHandler.java:86)
at rx.internal.operators.OnSubscribeToObservableFuture$ToObservableFuture.call(OnSubscribeToObservableFuture.java:74)
at rx.internal.operators.OnSubscribeToObservableFuture$ToObservableFuture.call(OnSubscribeToObservableFuture.java:43)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.subscribe(Observable.java:9957)
at rx.Observable.subscribe(Observable.java:9924)
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:445)
... 7 more
Caused by: com.pokegoapi.exceptions.RemoteServerException: Got a unexpected http code : 502
at com.pokegoapi.main.RequestHandler.internalSendServerRequests(RequestHandler.java:195)
at com.pokegoapi.main.RequestHandler.run(RequestHandler.java:289)
... 1 more
com.pokegoapi.exceptions.AsyncPokemonGoException: Unknown exception occurred.
at com.pokegoapi.util.AsyncHelper.toBlocking(AsyncHelper.java:45)
at com.pokegoapi.main.RequestHandler.sendServerRequests(RequestHandler.java:155)
at com.pokegoapi.api.inventory.Inventories.updateInventories(Inventories.java:108)
at com.pokegoapi.api.inventory.Inventories.updateInventories(Inventories.java:84)
at com.pokegoapi.api.inventory.Inventories.
Can you post the full code where you use the methods?
Collection
On 8/3/2016 3:10 PM, Fabian Terhorst wrote:
Can you post the full code where you use the methods?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Grover-c13/PokeGOAPI-Java/issues/477#issuecomment-237340201, or mute the thread https://github.com/notifications/unsubscribe-auth/ALDSxwIWiYuy4sugF8mgPUD6uhFPSBqvks5qcOeagaJpZM4Jb_OU.
s.inRange() is useless. s.canLoot() also checks if it is in range.
Also posting to say that I've got the same problem.
Now I get this right after I log in.
go = new PokemonGo(cre, client, time);
bag = go.getInventories().getItemBag();
I have nothing between, and The second line throws the error.
On 8/3/2016 3:59 PM, Jari wrote:
s.inRange() is useless. s.canLoot() also checks if it is in range.
Also posting to say that I've got the same problem.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Grover-c13/PokeGOAPI-Java/issues/477#issuecomment-237353667, or mute the thread https://github.com/notifications/unsubscribe-auth/ALDSx7YhDTF33nZrvpK70w6IsShd6OXTks5qcPM2gaJpZM4Jb_OU.
Show us the stacktrace.
Also, please realize that this is for problems in THE API, not in YOUR PROJECT.
If you have troubles with programming in general, this is not the right place to ask questions.
Yeah, I am having the same problem using the 0.3.4 version available on jcenter. Please note that I am on Android.
EDIT : also having the same problem on the current commit https://github.com/Grover-c13/PokeGOAPI-Java/commit/626145894534c4e85213eaac4116a5be519b104a
Here is a stacktrace :
08-03 21:07:26.737 4816-4921/com.asdrubal.zubot W/System.err: com.pokegoapi.exceptions.AsyncPokemonGoException: Unknown exception occurred.
08-03 21:07:26.737 4816-4921/com.asdrubal.zubot W/System.err: at com.pokegoapi.util.AsyncHelper.toBlocking(AsyncHelper.java:45)
08-03 21:07:26.737 4816-4921/com.asdrubal.zubot W/System.err: at com.pokegoapi.api.map.Map.getCatchablePokemon(Map.java:154)
08-03 21:07:26.737 4816-4921/com.asdrubal.zubot W/System.err: at com.asdrubal.zubot.Zubot.catchCatchablePokemons(Zubot.java:349)
08-03 21:07:26.737 4816-4921/com.asdrubal.zubot W/System.err: at com.asdrubal.zubot.Zubot.update(Zubot.java:126)
08-03 21:07:26.737 4816-4921/com.asdrubal.zubot W/System.err: at com.asdrubal.zubot.Zubot.run(Zubot.java:176)
08-03 21:07:26.737 4816-4921/com.asdrubal.zubot W/System.err: Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.google.protobuf.InvalidProtocolBufferException: Contents of buffer are null
08-03 21:07:26.737 4816-4921/com.asdrubal.zubot W/System.err: at rx.exceptions.Exceptions.propagate(Exceptions.java:58)
08-03 21:07:26.738 4816-4921/com.asdrubal.zubot W/System.err: at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:465)
08-03 21:07:26.738 4816-4921/com.asdrubal.zubot W/System.err: at rx.observables.BlockingObservable.first(BlockingObservable.java:168)
08-03 21:07:26.738 4816-4921/com.asdrubal.zubot W/System.err: at com.pokegoapi.util.AsyncHelper.toBlocking(AsyncHelper.java:37)
08-03 21:07:26.738 4816-4921/com.asdrubal.zubot W/System.err: ... 4 more
this is the code I use inside my thread :
private void catchCatchablePokemons() throws LoginFailedException, RemoteServerException, InterruptedException {
if (pogo!=null){
log("Looking for catchable Pokemons...");
List<CatchablePokemon> pks = pogo.getMap().getCatchablePokemon();
if ((pks!=null) && (pks.size()>0)) {
for (CatchablePokemon pk : pks) {
NormalEncounterResult er = (NormalEncounterResult) pk.encounterNormalPokemon();
if (er.wasSuccessful()) {
try {
reportCatchingPokemon(pk, er);
Thread.sleep(config.delayBetweenActions);
CatchResult catchResult = pk.catchPokemon();
log(catchResult.toString());
reportCatchPokemonResult(pk, er, catchResult);
}catch (Exception e){
e.printStackTrace();
}
}
Thread.sleep(2500);
}
}
}
}
Sadye, It seems niantic changed their secret key for 10 minutes at 4PM EST. So this would be an API error due to the hard-coded client secret & client ID in the API.
the new app must have a second secret somewhere else in the apk.
OK, seems like Niantic did something. The official app seems to be working fine with gps spoofing. Seems like they found a way to detect unauthorized access to their API.
Check : https://www.reddit.com/r/pokemongodev/comments/4w0jum/all_ptcgoogle_logins_failing_from_api/
Apparently they changed the way the MapObjects data from the API is provided.
Looks like all API based on the first release of game are stopped working, the majority of users of the official PokemonGo App updated their app, so Niantic stopped the support of their older API. So we need to update this API to enable again data retrieve.
please refer to #486
I'm on commit ef1f52f1f0621f94b97125975c961a8ad8129e92. I still have this problem once in a while executing commands such as: go.getInventories().updateInventories(); go.getMap().getCatchablePokemon(); Once this happens, I have to terminate and rerun.
Same here. I also receive the same error message on getting pokestops after logging in.
Me also
Same issue, I just wanted to add that everything works most of the time so I doubt that it is a programming issue with our code.
I'm assuming it had something to do with too many requests in a given period although I am throttling pokestop and pokemon scans.
I have the same issue. My program does work for about 4 minutes or so without problems and it gives me this error randomly. I can loot pokestops and catch pokemons nicely until this gives me Async error. Sometimes before crashing it gives me this error when I try to catch a pokemon:
Pokemon in area:1 Encounted:SANDSHREW with cp: 113 A/CatchablePokemon: Got an error or unrecognized catch attempt A/CatchablePokemon: Proto:CatchResult(captureAward=, response=, status=CATCH_ERROR, failed=true) Attempt to catch:SANDSHREW CATCH_ERROR
Then the next pokemon crashes the program.
I think I sorta found a fix. I just cached the Go object and refreshed it once every 9 minutes. I also cached the Pokestops and refreshed them every 15 seconds. So far, no async exceptions.