Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncPokemonGoException: Unknown #477

Closed
jsl303 opened this issue Aug 3, 2016 · 17 comments
Closed

AsyncPokemonGoException: Unknown #477

jsl303 opened this issue Aug 3, 2016 · 17 comments

Comments

@jsl303
Copy link

jsl303 commented Aug 3, 2016

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 6261458.
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.(Inventories.java:74)
at com.pokegoapi.api.PokemonGo.getInventories(PokemonGo.java:130)
at PokePlay.login(PokePlay.java:97)
at PokePlay.run(PokePlay.java:248)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.pokegoapi.exceptions.RemoteServerException: java.net.SocketTimeoutException: Read timed out
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)
... 8 more
Caused by: java.util.concurrent.ExecutionException: com.pokegoapi.exceptions.RemoteServerException: java.net.SocketTimeoutException: Read timed out
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)
... 10 more
Caused by: com.pokegoapi.exceptions.RemoteServerException: java.net.SocketTimeoutException: Read timed out
at com.pokegoapi.main.RequestHandler.internalSendServerRequests(RequestHandler.java:238)
at com.pokegoapi.main.RequestHandler.internalSendServerRequests(RequestHandler.java:219)
at com.pokegoapi.main.RequestHandler.run(RequestHandler.java:289)
... 1 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.security.ssl.InputRecord.readFully(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at sun.security.ssl.AppInputStream.read(Unknown Source)
at okio.Okio$2.read(Okio.java:138)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:238)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:325)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:314)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
at okhttp3.internal.http.Http1xStream.readResponse(Http1xStream.java:186)
at okhttp3.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
at okhttp3.RealCall.execute(RealCall.java:60)
at com.pokegoapi.main.RequestHandler.internalSendServerRequests(RequestHandler.java:193)
... 3 more
com.pokegoapi.exceptions.AsyncPokemonGoException: Unknown exception occurred.
at com.pokegoapi.util.AsyncHelper.toBlocking(AsyncHelper.java:45)
at com.pokegoapi.api.map.Map.getMapObjects(Map.java:410)
at PokePlay.run(PokePlay.java:210)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.pokegoapi.exceptions.RemoteServerException: java.net.SocketTimeoutException: timeout
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)
... 3 more
Caused by: java.util.concurrent.ExecutionException: com.pokegoapi.exceptions.RemoteServerException: java.net.SocketTimeoutException: timeout
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.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
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)
... 5 more
Caused by: com.pokegoapi.exceptions.RemoteServerException: java.net.SocketTimeoutException: timeout
at com.pokegoapi.main.RequestHandler.internalSendServerRequests(RequestHandler.java:238)
at com.pokegoapi.main.RequestHandler.run(RequestHandler.java:289)
... 1 more
Caused by: java.net.SocketTimeoutException: timeout
at okio.Okio$3.newTimeoutException(Okio.java:210)
at okio.AsyncTimeout.exit(AsyncTimeout.java:288)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:242)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:325)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:314)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
at okhttp3.internal.http.Http1xStream.readResponse(Http1xStream.java:186)
at okhttp3.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
at okhttp3.RealCall.execute(RealCall.java:60)
at com.pokegoapi.main.RequestHandler.internalSendServerRequests(RequestHandler.java:193)
... 2 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.security.ssl.InputRecord.readFully(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at sun.security.ssl.AppInputStream.read(Unknown Source)
at okio.Okio$2.read(Okio.java:138)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:238)
... 23 more

@FabianTerhorst
Copy link
Collaborator

Can you post the full code where you use the methods?

@jsl303
Copy link
Author

jsl303 commented Aug 3, 2016

Collection stops = map.getMapObjects().getPokestops();
for (Pokestop s:stops) {
if (s.inRange() & s.canLoot()) {
PokestopLootResult res = s.loot();
int rsize = res.getItemsAwarded().size();
System.out.println(rsize+" items received at "+new Date().toString()+".");
}
}
go.getInventories().updateInventories();
if (bag.getItemsCount() > 300) discard();

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
#477 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALDSxwIWiYuy4sugF8mgPUD6uhFPSBqvks5qcOeagaJpZM4Jb_OU.

@Jari27
Copy link
Contributor

Jari27 commented Aug 3, 2016

s.inRange() is useless. s.canLoot() also checks if it is in range.

Also posting to say that I've got the same problem.

@jsl303
Copy link
Author

jsl303 commented Aug 3, 2016

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
#477 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALDSx7YhDTF33nZrvpK70w6IsShd6OXTks5qcPM2gaJpZM4Jb_OU.

@Jari27
Copy link
Contributor

Jari27 commented Aug 3, 2016

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.

@hugorosario
Copy link

hugorosario commented Aug 3, 2016

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 6261458

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);
                }
            }
        }
    }

@SippieCup
Copy link

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.

@hugorosario
Copy link

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/

@illusion12
Copy link

Apparently they changed the way the MapObjects data from the API is provided.

@meher19
Copy link

meher19 commented Aug 3, 2016

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.

@vmarchaud
Copy link
Contributor

vmarchaud commented Aug 4, 2016

please refer to #486

@jsl303
Copy link
Author

jsl303 commented Aug 8, 2016

I'm on commit ef1f52f.
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.

@DaveBben
Copy link

DaveBben commented Aug 9, 2016

Same here. I also receive the same error message on getting pokestops after logging in.

@KyleBoyer
Copy link

Me also

@behelit
Copy link

behelit commented Aug 10, 2016

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.

@nacheteam
Copy link

nacheteam commented Aug 12, 2016

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.

@DaveBben
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests