[Bug] uncaught KeyError exception in block_record
See original GitHub issueWhat happened?
I am not sure if this would be possible to reproduce, but I was running chia on raspberry (4GB RAM) for a like half a year, when in October the entire FS crashed, and I had to reinstall and unfortunately sync from scratch. After like 2 months of checking and regular restarts of chia daemon it got into near sync state of blockchain (wallet was full sync, but chain last day missing, this was somewhere between 21-22nd December). But when I’ve checked it after Christmas, the log is full of this:
2021-12-27T13:59:13.294 full_node full_node_server : WARNING Banning 99.152.32.71 for 10 seconds
2021-12-27T13:59:13.296 full_node chia.full_node.full_node: INFO peer disconnected {'host': '99.152.32.71', 'port': 8444}
2021-12-27T13:59:13.298 full_node full_node_server : ERROR Exception b'\xd7\x80\xd2,z\x87\xc9\xe0\x1d\x98\xb4\x9a\t\x10\xf6p\x1c;\x95\x01WA1k?\xda\x04.]{\x81\xd2', exception Stack: Traceback (most recent call last):
File "chia/server/server.py", line 437, in start_client
File "chia/server/server.py", line 335, in connection_added
File "chia/full_node/full_node.py", line 619, in on_connect
File "chia/full_node/full_node.py", line 585, in synced
File "chia/consensus/blockchain.py", line 157, in get_peak
File "chia/consensus/blockchain.py", line 674, in height_to_block_record
File "chia/consensus/blockchain.py", line 670, in block_record
KeyError: b'\xd7\x80\xd2,z\x87\xc9\xe0\x1d\x98\xb4\x9a\t\x10\xf6p\x1c;\x95\x01WA1k?\xda\x04.]{\x81\xd2'
2021-12-27T13:59:13.301 full_node asyncio : ERROR Task exception was never retrieved
future: <Task finished name='Task-291378' coro=<RpcServer._state_changed() done, defined at chia/rpc/rpc_server.py:48> exception=KeyError(b'\xd7\x80\xd2,z\x87\xc9\xe0\x1d\x98\xb4\x9a\t\x10\xf6p\x1c;\x95\x01WA1k?\xda\x04.]{\x81\xd2')>
Traceback (most recent call last):
File "chia/rpc/rpc_server.py", line 51, in _state_changed
File "chia/rpc/full_node_rpc_api.py", line 61, in _state_changed
File "chia/rpc/full_node_rpc_api.py", line 102, in get_blockchain_state
File "chia/consensus/blockchain.py", line 157, in get_peak
File "chia/consensus/blockchain.py", line 674, in height_to_block_record
File "chia/consensus/blockchain.py", line 670, in block_record
KeyError: b'\xd7\x80\xd2,z\x87\xc9\xe0\x1d\x98\xb4\x9a\t\x10\xf6p\x1c;\x95\x01WA1k?\xda\x04.]{\x81\xd2'
2021-12-27T13:59:14.603 full_node full_node_server : INFO Cannot connect to host 112.25.210.130:8444 ssl:<ssl.SSLContext object at 0xffff377097c0> [Connect call failed ('112.25.210.130', 8444)]
running eg. chia show -s results in similar message:
Exception from 'show' Traceback (most recent call last):
File "chia/cmds/show.py", line 41, in show_async
File "chia/rpc/full_node_rpc_client.py", line 27, in get_blockchain_state
File "chia/rpc/rpc_client.py", line 49, in fetch
ValueError: {'error': "b'\\xd7\\x80\\xd2,z\\x87\\xc9\\xe0\\x1d\\x98\\xb4\\x9a\\t\\x10\\xf6p\\x1c;\\x95\\x01WA1k?\\xda\\x04.]{\\x81\\xd2'", 'success': False}
but chia wallet show is ok, so seems only main daemon is somehow stuck:
chia wallet show
Wallet height: 1338206
Sync status: Synced
...
Version
1.2.11
What platform are you using?
Pi4
What ui mode are you using?
CLI
Relevant log output
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:88 (5 by maintainers)
Top Results From Across the Web
Python KeyError Exceptions and How to Handle Them
In this tutorial, you'll learn how to handle Python KeyError exceptions. They are often caused by a bad key lookup in a dictionary,...
Read more >How to fix Python KeyError Exceptions in simple steps?
First, we access an existing key in the try-except block. If the Keyerror is not raised, there are no errors. Then the else...
Read more >How to Fix KeyError Exceptions in Python - Rollbar
The Python KeyError is an exception that occurs when an attempt is made to access an item in a dictionary that does not...
Read more >How to fix " KeyError: 'log_context' " on Flask - Stack Overflow
error ('Uncaught error thrown by Flask/Werkzeug', exc_info=ex) response = jsonify(message=str(ex), type='api_error') response.status_code = (ex.
Read more >login key error on Manual talk:Pywikibot - MediaWiki
and (response['messagecode'] == 'login-throttled'. KeyError: 'messagecode'. CRITICAL: Exiting due to uncaught exception <class 'KeyError'>.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve just checked my node, and you are right, the block 0 is actually set as peak:
So I’ve tried swapping peak on block 0 vs last block as suggested:
and yes, it solves the problem, chia is again syncing. Question still remains how this could happen? Some remote trigger? ( / attacker?) Client bug? Protocol bug?
We will shortly release 1.3 beta which fixes this issue.