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

KeyError: 'GET_INVENTORY' #1491

Closed
Lunik opened this issue Jul 28, 2016 · 35 comments
Closed

KeyError: 'GET_INVENTORY' #1491

Lunik opened this issue Jul 28, 2016 · 35 comments

Comments

@Lunik
Copy link

Lunik commented Jul 28, 2016

Expected Behavior

Actual Behavior

Traceback (most recent call last):
  File "./pokecli.py", line 357, in <module>
    main()
  File "./pokecli.py", line 68, in main
    bot.tick()
  File "/home/lunik/PokemonGo-Bot/pokemongo_bot/__init__.py", line 64, in tick
    if worker(self).work() == WorkerResult.RUNNING:
  File "/home/lunik/PokemonGo-Bot/pokemongo_bot/cell_workers/recycle_items_worker.py", line 14, in work
    item_count_dict = self.bot.item_inventory_count('all')
  File "/home/lunik/PokemonGo-Bot/pokemongo_bot/__init__.py", line 361, in item_inventory_count
    'GET_INVENTORY']['inventory_delta']['inventory_items']
KeyError: 'GET_INVENTORY'

Steps to Reproduce

run ./run.sh in dev branch

Other Information

OS: Ubuntu
Git Commit: c11af09

@banksymate
Copy link

I'm getting the same.
Traceback (most recent call last): File "pokecli.py", line 357, in <module> main() File "pokecli.py", line 68, in main bot.tick() File "/root/pgo/dev/PokemonGo-Bot/pokemongo_bot/__init__.py", line 64, in tick if worker(self).work() == WorkerResult.RUNNING: File "/root/pgo/dev/PokemonGo-Bot/pokemongo_bot/cell_workers/recycle_items_worker.py", line 14, in work item_count_dict = self.bot.item_inventory_count('all') File "/root/pgo/dev/PokemonGo-Bot/pokemongo_bot/__init__.py", line 361, in item_inventory_count 'GET_INVENTORY']['inventory_delta']['inventory_items'] KeyError: 'GET_INVENTORY'

@d0t1q
Copy link

d0t1q commented Jul 28, 2016

I can confirm and replicate this issue

./pokecli.py -cf conf.json
[21:24:04] PokemonGO Bot v1.0
[21:24:04] Configuration initialized
[21:24:04] [x] Coordinates found in passed in location, not geocoding.
[21:24:04]
[21:24:04] Location Found: **
[21:24:04] GeoPosition: (**)
[21:24:04]
[21:24:04] Attempting login to Pokemon Go.
[21:24:05] Login to Pokemon Go successful.
Traceback (most recent call last):
File "./pokecli.py", line 357, in
main()
File "./pokecli.py", line 62, in main
bot.start()
File "/var/www/PokemonGo-Bot/pokemongo_bot/init.py", line 44, in start
self._setup_api()
File "/var/www/PokemonGo-Bot/pokemongo_bot/init.py", line 234, in _setup_api
self._print_character_info()
File "/var/www/PokemonGo-Bot/pokemongo_bot/init.py", line 265, in _print_character_info
items_stock = self.current_inventory()
File "/var/www/PokemonGo-Bot/pokemongo_bot/init.py", line 335, in current_inventory
inventory_dict = inventory_req['responses']['GET_INVENTORY'][
KeyError: 'GET_INVENTORY'

@banksymate
Copy link

May be an issue with Pokemon GO servers.

@ramponee
Copy link

Can confirm, running bot exits wirh map_cells, and after restart GET_INVENTORY. Oh well, servers were really unstable today ;)

@jonathanbalagot
Copy link

Servers have been going up and down all day so the API can't return any info.

@d0t1q
Copy link

d0t1q commented Jul 28, 2016

Not sure about that, this only happened after I ran a pull request, and another account of mine running via the main branch is running fine.

And this commit did have a change to the init.py file and they introduced an api wrapper file

c11af09

The servers are fine now, there were unstable a few hours ago but you can still run any api call you want(manually) if I can run an api call but the bot cant, its a problem with the code

@A7F
Copy link

A7F commented Jul 28, 2016

same issue here, I think the problem is server related, too but maybe they changed something... so the bot cn't parse correctly inventory infos.
btw i'm just guessing....

@banksymate
Copy link

banksymate commented Jul 28, 2016

Maybe they're starting to block API requests that aren't using the "random bytes"
https://www.reddit.com/r/pokemongodev/comments/4tzgbw/anyone_knowing_more_about_the_infamous_unknown/
edit:
just saw d0t1q's post.

@incizzle
Copy link

Severs are unstable rn thats it dont worry guys

@banksymate
Copy link

banksymate commented Jul 28, 2016

ignore

@aTadTasty
Copy link

it's a server instability issue. this has been happening on both google accounts and ptc accounts

@skartoffel
Copy link

Well since I can get my inventory when I am logged in in the actual application I wonder why the bot has this errors :(

@Dunduro
Copy link

Dunduro commented Jul 28, 2016

ya same here @skartoffel works on iphone just fine aswel ass on bluestacks android emulator

@Kujawadl
Copy link

Kujawadl commented Jul 28, 2016

Not sure if this is related, maybe someone can confirm:

My inventory was full. I opened the app, cleared some things out, set stricter limits in config.json, and then removed data/cells-[username].json before restarting.

It works for me now, though that could be coincidence. Need someone to confirm.

Update: Lasted for about 10 minutes, it's back now.

@skartoffel
Copy link

Inventory was not full, deleting cells-username.json did nothing :(

@pickerflicker
Copy link

my inventory is NOT full. Still encountering this problem with the bot. Able to login to the game on my phone.

@Kujawadl
Copy link

Also, not only did it work on my phone while the bot was failing, but I have a second bot for my brother's account that is working just fine, so I think it's unlikely to be a server problem.

@A7F
Copy link

A7F commented Jul 28, 2016

@Kujawadl are the same bots? I mean, same bots with same commits?

@Dunduro
Copy link

Dunduro commented Jul 28, 2016

@A7F i was running 2 bots aswel and 1 failed a good 20-30 minutes before the other one, running on same install just different screen sessions

@Kujawadl
Copy link

@A7F Yes, same commits. His has been running several hours now without problems, mine crashes immediately after login.

Running on different screen sessions like @Dunduro

@Lunik Lunik mentioned this issue Jul 28, 2016
@A7F
Copy link

A7F commented Jul 28, 2016

just tried to revert my pull using
git reset HEAD@{1}
result: same crash but displays me my player infos (those printed in light blue)

@loiclaudet
Copy link

I'm running the code since many days on the old 6e99169 (dev branch). For the first time today I encountered the Inventory Error.

@klingan
Copy link
Contributor

klingan commented Jul 28, 2016

crashes now and then with this error, correct behavior would be to catch the exception and retry the login procedure

@SethCalkins
Copy link

SethCalkins commented Jul 28, 2016

First Error

[18:09:20] Attempting login to Pokemon Go.
[18:09:20] Login to Pokemon Go successful.
[18:09:21]
[18:09:21] --- MYUSERNAME ---
[18:09:21] Level: 21 (Next Level: 48290 XP) (Total: 286710 XP)
[18:09:21] Pokemon Captured: 915 | Pokestops Visited: 504
[18:09:21] Pokemon Bag: 177/250
[18:09:21] Items: 204/350
[18:09:21] Stardust: 2011 | Pokecoins: 0
[18:09:21] PokeBalls: 46 | GreatBalls: 50 | UltraBalls: 10
[18:09:21] RazzBerries: 0 | BlukBerries: 0 | NanabBerries: 0
[18:09:21] LuckyEgg: 0 | Incubator: 2 | TroyDisk: 5
[18:09:21] Potion: 10 | SuperPotion: 25 | HyperPotion: 25
[18:09:21] Incense: 4 | IncenseSpicy: 0 | IncenseCool: 0
[18:09:21] Revive: 25 | MaxRevive: 0
[18:09:21]
[18:09:21]
[18:09:21] Starting PokemonGo Bot....
[18:09:22] Releasing Oddish with CP 236 and IV 0.62. Matching release rule: CP < 400 AND IV < 0.8.
[18:09:22] Exchanging Oddish [CP 236] [Potential 0.62] for candy!
[18:09:24] Scanning area for objects....
[18:09:24] Walking from (51.990094618072625, -89.93739658544594) to [51.990094618072625, -89.93739658544594] 0.00km

[18:09:24] Releasing Oddish with CP 236 and IV 0.62. Matching release rule: CP < 400 AND IV < 0.8.
[18:09:24] Exchanging Oddish [CP 236] [Potential 0.62] for candy!
[18:09:27] [x] Found fort 3769a62d5ffa43ad88cd2954d628cdba.16 at distance 0.36km
[18:09:27] [x] Need to move closer to Pokestop
[18:09:29] [x] Found fort 3769a62d5ffa43ad88cd2954d628cdba.16 at distance 0.36km
[18:09:29] [x] Need to move closer to Pokestop
[18:09:31] [x] Found fort 3769a62d5ffa43ad88cd2954d628cdba.16 at distance 0.36km
[18:09:31] [x] Need to move closer to Pokestop
[18:09:33] [x] Found fort 3769a62d5ffa43ad88cd2954d628cdba.16 at distance 0.35km
[18:09:33] [x] Need to move closer to Pokestop
[18:09:36] [x] Found fort 3769a62d5ffa43ad88cd2954d628cdba.16 at distance 0.35km
[18:09:36] [x] Need to move closer to Pokestop
[18:09:38] [x] Found fort 3769a62d5ffa43ad88cd2954d628cdba.16 at distance 0.34km
[18:09:38] [x] Need to move closer to Pokestop
Traceback (most recent call last):
  File "pokecli.py", line 357, in <module>
    main()
  File "pokecli.py", line 68, in main
    bot.tick()
  File "/root/PokemonGo-Bot/pokemongo_bot/__init__.py", line 64, in tick
    if worker(self).work() == WorkerResult.RUNNING:
  File "/root/PokemonGo-Bot/pokemongo_bot/cell_workers/spin_nearest_fort_worker.py", line 24, in work
    if MoveToFortWorker(nearest_fort, self.bot).work() == WorkerResult.RUNNING:
  File "/root/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_fort_worker.py", line 39, in work
    if not step_walker.step():
  File "/root/PokemonGo-Bot/pokemongo_bot/step_walker.py", line 61, in step
    self.bot.heartbeat()
  File "/root/PokemonGo-Bot/pokemongo_bot/__init__.py", line 466, in heartbeat
    self.update_web_location() # updates every tick
  File "/root/PokemonGo-Bot/pokemongo_bot/__init__.py", line 112, in update_web_location
    cells = map_objects['map_cells']
KeyError: 'map_cells'

Second Error

[18:08:14] --- MYUSERNAME ---
[18:08:14] Level: 21 (Next Level: 48290 XP) (Total: 286710 XP)
[18:08:14] Pokemon Captured: 915 | Pokestops Visited: 504
[18:08:14] Pokemon Bag: 193/250
[18:08:14] Items: 272/350
[18:08:14] Stardust: 2011 | Pokecoins: 0
[18:08:14] PokeBalls: 46 | GreatBalls: 101 | UltraBalls: 10
[18:08:14] RazzBerries: 0 | BlukBerries: 0 | NanabBerries: 0
[18:08:14] LuckyEgg: 0 | Incubator: 2 | TroyDisk: 5
[18:08:14] Potion: 12 | SuperPotion: 30 | HyperPotion: 30
[18:08:14] Incense: 4 | IncenseSpicy: 0 | IncenseCool: 0
[18:08:14] Revive: 30 | MaxRevive: 0
[18:08:14]
[18:08:14]
[18:08:14] Starting PokemonGo Bot....
[18:08:15] Releasing Oddish with CP 236 and IV 0.62. Matching release rule: CP < 400 AND IV < 0.8.
[18:08:15] Exchanging Oddish [CP 236] [Potential 0.62] for candy!
[18:08:18] Releasing Pidgey with CP 227 and IV 0.4. Matching release rule: CP < 237 AND IV < 0.8.
[18:08:18] Exchanging Pidgey [CP 227] [Potential 0.4] for candy!
[18:08:21] Releasing Pidgey with CP 213 and IV 0.76. Matching release rule: CP < 237 AND IV < 0.8.
[18:08:21] Exchanging Pidgey [CP 213] [Potential 0.76] for candy!
[18:08:25] Releasing Pidgey with CP 206 and IV 0.38. Matching release rule: CP < 237 AND IV < 0.8.
[18:08:25] Exchanging Pidgey [CP 206] [Potential 0.38] for candy!
[18:08:27] Releasing Pidgeotto with CP 405 and IV 0.51. Matching release rule: CP < 427 AND IV < 0.8.
[18:08:27] Exchanging Pidgeotto [CP 405] [Potential 0.51] for candy!
[18:08:29] Releasing Pidgeotto with CP 348 and IV 0.58. Matching release rule: CP < 427 AND IV < 0.8.
[18:08:29] Exchanging Pidgeotto [CP 348] [Potential 0.58] for candy!
[18:08:33] Releasing Pidgeot with CP 590 and IV 0.38. Matching release rule: CP < 729 AND IV < 0.8.
[18:08:33] Exchanging Pidgeot [CP 590] [Potential 0.38] for candy!
[18:08:36] Releasing Pidgeot with CP 309 and IV 0.31. Matching release rule: CP < 729 AND IV < 0.8.
[18:08:36] Exchanging Pidgeot [CP 309] [Potential 0.31] for candy!
[18:08:38] Releasing Rattata with CP 70 and IV 0.73. Matching release rule: CP < 204 AND IV < 0.8.
[18:08:38] Exchanging Rattata [CP 70] [Potential 0.73] for candy!
[18:08:41] Releasing Zubat with CP 221 and IV 0.42. Matching release rule: CP < 225 AND IV < 0.8.
[18:08:41] Exchanging Zubat [CP 221] [Potential 0.42] for candy!
[18:08:44] Releasing Venonat with CP 250 and IV 0.76. Matching release rule: CP < 360 AND IV < 0.8.
[18:08:44] Exchanging Venonat [CP 250] [Potential 0.76] for candy!
[18:08:47] Releasing Venonat with CP 244 and IV 0.64. Matching release rule: CP < 360 AND IV < 0.8.
[18:08:47] Exchanging Venonat [CP 244] [Potential 0.64] for candy!
[18:08:50] Releasing Venonat with CP 218 and IV 0.69. Matching release rule: CP < 360 AND IV < 0.8.
[18:08:50] Exchanging Venonat [CP 218] [Potential 0.69] for candy!
[18:08:52] Releasing Venomoth with CP 290 and IV 0.53. Matching release rule: CP < 660 AND IV < 0.8.
[18:08:52] Exchanging Venomoth [CP 290] [Potential 0.53] for candy!
[18:08:53] Releasing Bellsprout with CP 359 and IV 0.71. Matching release rule: CP < 391 AND IV < 0.8.
[18:08:53] Exchanging Bellsprout [CP 359] [Potential 0.71] for candy!
[18:08:57] Releasing Drowzee with CP 249 and IV 0.42. Matching release rule: CP < 374 AND IV < 0.8.
[18:08:57] Exchanging Drowzee [CP 249] [Potential 0.42] for candy!
[18:09:01] Releasing Exeggcute with CP 207 and IV 0.78. Matching release rule: CP < 384 AND IV < 0.8.
[18:09:01] Exchanging Exeggcute [CP 207] [Potential 0.78] for candy!
[18:09:05] -- Recycled 51x Greatball (keeps only 50 maximum)
[18:09:06] -- Recycled 5x Hyper Potion (keeps only 25 maximum)
[18:09:06] -- Recycled 5x Revive (keeps only 25 maximum)
[18:09:06] -- Recycled 5x Super Potion (keeps only 25 maximum)
[18:09:07] -- Recycled 2x Potion (keeps only 10 maximum)
[18:09:07] Scanning area for objects....
[18:09:07] Walking from (51.990094618072625, -89.93739658544594) to [51.990094618072625, -89.93739658544594] 0.00km
Traceback (most recent call last):
  File "pokecli.py", line 357, in <module>
    main()
  File "pokecli.py", line 68, in main
    bot.tick()
  File "/root/PokemonGo-Bot/pokemongo_bot/__init__.py", line 64, in tick
    if worker(self).work() == WorkerResult.RUNNING:
  File "/root/PokemonGo-Bot/pokemongo_bot/cell_workers/pokemon_transfer_worker.py", line 18, in work
    pokemon_groups = self._release_pokemon_get_groups()
  File "/root/PokemonGo-Bot/pokemongo_bot/cell_workers/pokemon_transfer_worker.py", line 73, in _release_pokemon_get_groups
    inventory_dict = inventory_req['responses']['GET_INVENTORY']['inventory_delta']['inventory_items']
KeyError: 'GET_INVENTORY'

Debug

auth_info {
  provider: "google"
  token {
    contents: "...[hidden]..."
    unknown2: 59
  }
}
unknown12: 989

2016-07-28 18:17:46,174 [   rpc_api] [DEBUG] Execution of RPC
2016-07-28 18:17:46,176 [connectionpool] [ INFO] Starting new HTTPS connection (1): pgorelease.nianticlabs.com
2016-07-28 18:17:46,305 [connectionpool] [DEBUG] "POST /plfe/314/rpc HTTP/1.1" 200 2
2016-07-28 18:17:46,306 [   rpc_api] [DEBUG] Parsing main RPC response...
2016-07-28 18:17:46,306 [   rpc_api] [DEBUG] Protobuf structure of rpc response:
status_code: 52

2016-07-28 18:17:46,311 [   rpc_api] [DEBUG] Decode raw over protoc (protoc has to be in your PATH):
Couldn't find protoc in your environment OR other issue...
2016-07-28 18:17:46,311 [   rpc_api] [DEBUG] Parsing sub RPC responses...
2016-07-28 18:17:46,311 [    pgoapi] [ INFO] Cleanup of request!
Traceback (most recent call last):
  File "pokecli.py", line 357, in <module>
    main()
  File "pokecli.py", line 62, in main
    bot.start()
  File "/root/PokemonGo-Bot/pokemongo_bot/__init__.py", line 44, in start
    self._setup_api()
  File "/root/PokemonGo-Bot/pokemongo_bot/__init__.py", line 234, in _setup_api
    self._print_character_info()
  File "/root/PokemonGo-Bot/pokemongo_bot/__init__.py", line 265, in _print_character_info
    items_stock = self.current_inventory()
  File "/root/PokemonGo-Bot/pokemongo_bot/__init__.py", line 335, in current_inventory
    inventory_dict = inventory_req['responses']['GET_INVENTORY'][
KeyError: 'GET_INVENTORY'

@Sekunde
Copy link

Sekunde commented Jul 28, 2016

In master branch, it has the same error, but recover soon.

Traceback (most recent call last):
File "pokecli.py", line 220, in
main()
File "pokecli.py", line 206, in main
bot.start()
File "/home/ubuntu/PokemonGo-Bot/pokemongo_bot/init.py", line 31, in start
self._setup_api()
File "/home/ubuntu/PokemonGo-Bot/pokemongo_bot/init.py", line 159, in _setup_api
balls_stock = self.pokeball_inventory()
File "/home/ubuntu/PokemonGo-Bot/pokemongo_bot/init.py", line 234, in pokeball_inventory
inventory_dict = inventory_req['responses']['GET_INVENTORY'][
KeyError: 'GET_INVENTORY'
[2016-07-28 22:22:14] [x] PokemonGO Bot v1.0
[2016-07-28 22:22:14] [x] Configuration initialized
[2016-07-28 22:22:14]
[2016-07-28 22:22:14] [x] Address found:
[2016-07-28 22:22:14] [x] Position in-

@SethCalkins
Copy link

SethCalkins commented Jul 28, 2016

perhaps this is it...

UnboundLocalError: local variable 'player' referenced before assignment

@lennart24
Copy link

lennart24 commented Jul 28, 2016

the newest commit 47cf9db fixes it.. somehow xD

[18:30:59] Server seems to be busy or offline - try again - 1/5
[18:31:03] [x] Found fort xxx.11 at distance 0.07km
[18:31:03] [x] Need to move closer to Pokestop
[18:31:04] Server seems to be busy or offline - try again - 1/5
[18:31:08] [x] Found fort xxx.11 at distance 0.07km
[18:31:08] [x] Need to move closer to Pokestop
[18:31:09] Server seems to be busy or offline - try again - 1/5
[18:31:12] [x] Found fort xxx.11 at distance 0.06km
[18:31:12] [x] Need to move closer to Pokestop
[18:31:13] Server seems to be busy or offline - try again - 1/5
[18:31:17] [x] Found fort xxx.11 at distance 0.06km
[18:31:17] [x] Need to move closer to Pokestop

but the bot is walking and catching pokemon!

@Dunduro
Copy link

Dunduro commented Jul 28, 2016

after the pulling commit 47cf9db seems to be working fine now

@snorlaxrazzi
Copy link

Same issue as original poster

@Strange-Penguin
Copy link

Will confirm. 47cf9db is a quick bandaid for this issue

@d0t1q
Copy link

d0t1q commented Jul 28, 2016

Yup 47cf9db fixes this, deffintly something with the newly added api_wrapper(since it was the only change)
Totally a server issue right?/s

@th3w4y
Copy link
Contributor

th3w4y commented Jul 28, 2016

I also get same issue

In [5]: bot.get_inventory()
Out[5]: {'responses': {}, 'status_code': 52}

In [6]:

@javiermar
Copy link

I can confirm inexion's theory. New account worked on head of master branch.

There should be a distance check in the algorithm to prevent teleporting. I'd help, but I can't python.

@asiletto
Copy link

I tested with a new account and I get the same error.

I tested it from an aws server, maybe if inexion theory is correct there is also an ip range block?

@tstumm
Copy link
Contributor

tstumm commented Jul 29, 2016

Should be fixed in latest dev

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

No branches or pull requests