KeyError: 'name' on startup #124

Closed
opened 2026-08-10 01:29:36 +00:00 by W1CDN · 4 comments

Hi Ian.

I attempted to first upgrade my install (nginx), and then started from a clean git clone / follow https://git.ianrenton.com/ian/spothole/src/branch/main/docs/running.md, but I am running into this KeyError. From what I can tell, there used to be a name field (there was in my old config) but now it is gone--is that related?

Thanks for any ideas, it's likely something silly on my end.
Thanks,
Matt

Aug 09 20:25:07 amiok.net systemd[1]: spothole.service: Scheduled restart job, restart counter is at 337.
Aug 09 20:25:07 amiok.net systemd[1]: Stopped spothole.service - Spothole.
Aug 09 20:25:07 amiok.net systemd[1]: Started spothole.service - Spothole.
Aug 09 20:25:07 amiok.net python[3068307]: Traceback (most recent call last):
Aug 09 20:25:07 amiok.net python[3068307]:   File "/home/matt/spothole/spothole.py", line 11, in <module>
Aug 09 20:25:07 amiok.net python[3068307]:     from core.config import config, SERVER_OWNER_CALLSIGN, LOG_LEVEL
Aug 09 20:25:07 amiok.net python[3068307]:   File "/home/matt/spothole/core/config.py", line 30, in <module>
Aug 09 20:25:07 amiok.net python[3068307]:     WEB_UI_OPTIONS["spot-providers-enabled-by-default"] = [p["name"] for p in config["spot-providers"] if p["enabled"] and (
Aug 09 20:25:07 amiok.net python[3068307]:                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 09 20:25:07 amiok.net python[3068307]:   File "/home/matt/spothole/core/config.py", line 30, in <listcomp>
Aug 09 20:25:07 amiok.net python[3068307]:     WEB_UI_OPTIONS["spot-providers-enabled-by-default"] = [p["name"] for p in config["spot-providers"] if p["enabled"] and (
Aug 09 20:25:07 amiok.net python[3068307]:                                                            ~^^^^^^^^
Aug 09 20:25:07 amiok.net python[3068307]: KeyError: 'name'
Aug 09 20:25:07 amiok.net systemd[1]: spothole.service: Main process exited, code=exited, status=1/FAILURE
Aug 09 20:25:07 amiok.net systemd[1]: spothole.service: Failed with result 'exit-code'.
Hi Ian. I attempted to first upgrade my install (nginx), and then started from a clean `git clone` / follow https://git.ianrenton.com/ian/spothole/src/branch/main/docs/running.md, but I am running into this `KeyError`. From what I can tell, there used to be a `name` field (there was in my old config) but now it is gone--is that related? Thanks for any ideas, it's likely something silly on my end. Thanks, Matt ``` Aug 09 20:25:07 amiok.net systemd[1]: spothole.service: Scheduled restart job, restart counter is at 337. Aug 09 20:25:07 amiok.net systemd[1]: Stopped spothole.service - Spothole. Aug 09 20:25:07 amiok.net systemd[1]: Started spothole.service - Spothole. Aug 09 20:25:07 amiok.net python[3068307]: Traceback (most recent call last): Aug 09 20:25:07 amiok.net python[3068307]: File "/home/matt/spothole/spothole.py", line 11, in <module> Aug 09 20:25:07 amiok.net python[3068307]: from core.config import config, SERVER_OWNER_CALLSIGN, LOG_LEVEL Aug 09 20:25:07 amiok.net python[3068307]: File "/home/matt/spothole/core/config.py", line 30, in <module> Aug 09 20:25:07 amiok.net python[3068307]: WEB_UI_OPTIONS["spot-providers-enabled-by-default"] = [p["name"] for p in config["spot-providers"] if p["enabled"] and ( Aug 09 20:25:07 amiok.net python[3068307]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Aug 09 20:25:07 amiok.net python[3068307]: File "/home/matt/spothole/core/config.py", line 30, in <listcomp> Aug 09 20:25:07 amiok.net python[3068307]: WEB_UI_OPTIONS["spot-providers-enabled-by-default"] = [p["name"] for p in config["spot-providers"] if p["enabled"] and ( Aug 09 20:25:07 amiok.net python[3068307]: ~^^^^^^^^ Aug 09 20:25:07 amiok.net python[3068307]: KeyError: 'name' Aug 09 20:25:07 amiok.net systemd[1]: spothole.service: Main process exited, code=exited, status=1/FAILURE Aug 09 20:25:07 amiok.net systemd[1]: spothole.service: Failed with result 'exit-code'. ```
ian closed this issue 2026-08-10 05:06:37 +00:00
Owner

Sorry about that! I really should nuke my config.yml and start from scratch more often.

This should now be fixed, please pull the latest code and have another try.

Sorry about that! I really should nuke my config.yml and start from scratch more often. This should now be fixed, please pull the latest code and have another try.
ian added this to the 2.0 milestone 2026-08-10 05:07:54 +00:00
ian self-assigned this 2026-08-10 05:08:00 +00:00
Author

Thanks Ian!

I tried again (from scratch) and I am getting a different error. If it helps, I am running Python 3.11.2.

Aug 10 18:39:54 amiok.net systemd[1]: Started spothole.service - Spothole.
Aug 10 18:39:56 amiok.net python[3210458]: INFO : Starting...
Aug 10 18:39:56 amiok.net python[3210458]: INFO : This is Spothole version 1.5. This instance is run by N0CALL.
Aug 10 18:39:56 amiok.net python[3210458]: INFO : Downloading Country-files.com cty.plist...
Aug 10 18:39:57 amiok.net python[3210458]: INFO : Downloading dxcc.json...
Aug 10 18:39:57 amiok.net python[3210458]: Traceback (most recent call last):
Aug 10 18:39:57 amiok.net python[3210458]:   File "/home/matt/spothole/spothole.py", line 110, in <module>
Aug 10 18:39:57 amiok.net python[3210458]:     spot_providers.append(get_spot_provider_from_config(entry))
Aug 10 18:39:57 amiok.net python[3210458]:                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 10 18:39:57 amiok.net python[3210458]:   File "/home/matt/spothole/spothole.py", line 62, in get_spot_provider_from_config
Aug 10 18:39:57 amiok.net python[3210458]:     module = importlib.import_module('spotproviders.' + config_providers_entry["class"].lower())
Aug 10 18:39:57 amiok.net python[3210458]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 10 18:39:57 amiok.net python[3210458]:   File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
Aug 10 18:39:57 amiok.net python[3210458]:     return _bootstrap._gcd_import(name[level:], package, level)
Aug 10 18:39:57 amiok.net python[3210458]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 10 18:39:57 amiok.net python[3210458]:   File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
Aug 10 18:39:57 amiok.net python[3210458]:   File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
Aug 10 18:39:57 amiok.net python[3210458]:   File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
Aug 10 18:39:57 amiok.net python[3210458]:   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
Aug 10 18:39:57 amiok.net python[3210458]:   File "<frozen importlib._bootstrap_external>", line 936, in exec_module
Aug 10 18:39:57 amiok.net python[3210458]:   File "<frozen importlib._bootstrap_external>", line 1074, in get_code
Aug 10 18:39:57 amiok.net python[3210458]:   File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
Aug 10 18:39:57 amiok.net python[3210458]:   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
Aug 10 18:39:57 amiok.net python[3210458]:   File "/home/matt/spothole/spotproviders/gma.py", line 106
Aug 10 18:39:57 amiok.net python[3210458]:     f"HTTP {ref_response.status_code} when looking up GMA ref {source_spot["REF"]}")
Aug 10 18:39:57 amiok.net python[3210458]:                                                                             ^^^
Aug 10 18:39:57 amiok.net python[3210458]: SyntaxError: f-string: unmatched '['
Aug 10 18:39:58 amiok.net systemd[1]: spothole.service: Main process exited, code=exited, status=1/FAILURE
Aug 10 18:39:58 amiok.net systemd[1]: spothole.service: Failed with result 'exit-code'.
Aug 10 18:39:58 amiok.net systemd[1]: spothole.service: Consumed 3.517s CPU time.

This seems like a nested quotes thing. But if I try to fix that with

elif not ref_response.from_cache:
                            if not ref_response.ok:
                                logging.warning(
                                    f"HTTP {ref_response.status_code} when looking up GMA ref {source_spot['REF']}")
                            else:
                                logging.warning(
                                    f"GMA API returned a malformed response when looking up ref {source_spot['REF']}")

Then I end up with the one below, and I'm not sure whether I should keep trying to fix something that is running for you.

Aug 10 18:45:58 amiok.net systemd[1]: Started spothole.service - Spothole.
Aug 10 18:45:59 amiok.net python[3211148]: INFO : Starting...
Aug 10 18:45:59 amiok.net python[3211148]: INFO : This is Spothole version 1.5. This instance is run by N0CALL.
Aug 10 18:45:59 amiok.net python[3211148]: INFO : Downloading Country-files.com cty.plist...
Aug 10 18:46:01 amiok.net python[3211148]: INFO : Downloading dxcc.json...
Aug 10 18:46:01 amiok.net python[3211148]: WARNING : GMA spot provider configured but no api key was provided, this API will not be queried.
Aug 10 18:46:01 amiok.net python[3211148]: Traceback (most recent call last):
Aug 10 18:46:01 amiok.net python[3211148]:   File "/home/matt/spothole/spothole.py", line 110, in <module>
Aug 10 18:46:01 amiok.net python[3211148]:     spot_providers.append(get_spot_provider_from_config(entry))
Aug 10 18:46:01 amiok.net python[3211148]:                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 10 18:46:01 amiok.net python[3211148]:   File "/home/matt/spothole/spothole.py", line 64, in get_spot_provider_from_config
Aug 10 18:46:01 amiok.net python[3211148]:     return provider_class(config_providers_entry)
Aug 10 18:46:01 amiok.net python[3211148]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 10 18:46:01 amiok.net python[3211148]:   File "/home/matt/spothole/spotproviders/rbn.py", line 28, in __init__
Aug 10 18:46:01 amiok.net python[3211148]:     self._port = provider_config["port"]
Aug 10 18:46:01 amiok.net python[3211148]:                  ~~~~~~~~~~~~~~~^^^^^^^^
Aug 10 18:46:01 amiok.net python[3211148]: KeyError: 'port'
Aug 10 18:46:01 amiok.net systemd[1]: spothole.service: Main process exited, code=exited, status=1/FAILURE
Aug 10 18:46:01 amiok.net systemd[1]: spothole.service: Failed with result 'exit-code'.
Aug 10 18:46:01 amiok.net systemd[1]: spothole.service: Consumed 3.560s CPU time.
Thanks Ian! I tried again (from scratch) and I am getting a different error. If it helps, I am running Python 3.11.2. ``` Aug 10 18:39:54 amiok.net systemd[1]: Started spothole.service - Spothole. Aug 10 18:39:56 amiok.net python[3210458]: INFO : Starting... Aug 10 18:39:56 amiok.net python[3210458]: INFO : This is Spothole version 1.5. This instance is run by N0CALL. Aug 10 18:39:56 amiok.net python[3210458]: INFO : Downloading Country-files.com cty.plist... Aug 10 18:39:57 amiok.net python[3210458]: INFO : Downloading dxcc.json... Aug 10 18:39:57 amiok.net python[3210458]: Traceback (most recent call last): Aug 10 18:39:57 amiok.net python[3210458]: File "/home/matt/spothole/spothole.py", line 110, in <module> Aug 10 18:39:57 amiok.net python[3210458]: spot_providers.append(get_spot_provider_from_config(entry)) Aug 10 18:39:57 amiok.net python[3210458]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Aug 10 18:39:57 amiok.net python[3210458]: File "/home/matt/spothole/spothole.py", line 62, in get_spot_provider_from_config Aug 10 18:39:57 amiok.net python[3210458]: module = importlib.import_module('spotproviders.' + config_providers_entry["class"].lower()) Aug 10 18:39:57 amiok.net python[3210458]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Aug 10 18:39:57 amiok.net python[3210458]: File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module Aug 10 18:39:57 amiok.net python[3210458]: return _bootstrap._gcd_import(name[level:], package, level) Aug 10 18:39:57 amiok.net python[3210458]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Aug 10 18:39:57 amiok.net python[3210458]: File "<frozen importlib._bootstrap>", line 1206, in _gcd_import Aug 10 18:39:57 amiok.net python[3210458]: File "<frozen importlib._bootstrap>", line 1178, in _find_and_load Aug 10 18:39:57 amiok.net python[3210458]: File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked Aug 10 18:39:57 amiok.net python[3210458]: File "<frozen importlib._bootstrap>", line 690, in _load_unlocked Aug 10 18:39:57 amiok.net python[3210458]: File "<frozen importlib._bootstrap_external>", line 936, in exec_module Aug 10 18:39:57 amiok.net python[3210458]: File "<frozen importlib._bootstrap_external>", line 1074, in get_code Aug 10 18:39:57 amiok.net python[3210458]: File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code Aug 10 18:39:57 amiok.net python[3210458]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed Aug 10 18:39:57 amiok.net python[3210458]: File "/home/matt/spothole/spotproviders/gma.py", line 106 Aug 10 18:39:57 amiok.net python[3210458]: f"HTTP {ref_response.status_code} when looking up GMA ref {source_spot["REF"]}") Aug 10 18:39:57 amiok.net python[3210458]: ^^^ Aug 10 18:39:57 amiok.net python[3210458]: SyntaxError: f-string: unmatched '[' Aug 10 18:39:58 amiok.net systemd[1]: spothole.service: Main process exited, code=exited, status=1/FAILURE Aug 10 18:39:58 amiok.net systemd[1]: spothole.service: Failed with result 'exit-code'. Aug 10 18:39:58 amiok.net systemd[1]: spothole.service: Consumed 3.517s CPU time. ``` This seems like a nested quotes thing. But if I try to fix that with ``` elif not ref_response.from_cache: if not ref_response.ok: logging.warning( f"HTTP {ref_response.status_code} when looking up GMA ref {source_spot['REF']}") else: logging.warning( f"GMA API returned a malformed response when looking up ref {source_spot['REF']}") ``` Then I end up with the one below, and I'm not sure whether I should keep trying to fix something that is running for you. ``` Aug 10 18:45:58 amiok.net systemd[1]: Started spothole.service - Spothole. Aug 10 18:45:59 amiok.net python[3211148]: INFO : Starting... Aug 10 18:45:59 amiok.net python[3211148]: INFO : This is Spothole version 1.5. This instance is run by N0CALL. Aug 10 18:45:59 amiok.net python[3211148]: INFO : Downloading Country-files.com cty.plist... Aug 10 18:46:01 amiok.net python[3211148]: INFO : Downloading dxcc.json... Aug 10 18:46:01 amiok.net python[3211148]: WARNING : GMA spot provider configured but no api key was provided, this API will not be queried. Aug 10 18:46:01 amiok.net python[3211148]: Traceback (most recent call last): Aug 10 18:46:01 amiok.net python[3211148]: File "/home/matt/spothole/spothole.py", line 110, in <module> Aug 10 18:46:01 amiok.net python[3211148]: spot_providers.append(get_spot_provider_from_config(entry)) Aug 10 18:46:01 amiok.net python[3211148]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Aug 10 18:46:01 amiok.net python[3211148]: File "/home/matt/spothole/spothole.py", line 64, in get_spot_provider_from_config Aug 10 18:46:01 amiok.net python[3211148]: return provider_class(config_providers_entry) Aug 10 18:46:01 amiok.net python[3211148]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Aug 10 18:46:01 amiok.net python[3211148]: File "/home/matt/spothole/spotproviders/rbn.py", line 28, in __init__ Aug 10 18:46:01 amiok.net python[3211148]: self._port = provider_config["port"] Aug 10 18:46:01 amiok.net python[3211148]: ~~~~~~~~~~~~~~~^^^^^^^^ Aug 10 18:46:01 amiok.net python[3211148]: KeyError: 'port' Aug 10 18:46:01 amiok.net systemd[1]: spothole.service: Main process exited, code=exited, status=1/FAILURE Aug 10 18:46:01 amiok.net systemd[1]: spothole.service: Failed with result 'exit-code'. Aug 10 18:46:01 amiok.net systemd[1]: spothole.service: Consumed 3.560s CPU time. ```
Owner

Thanks again for your patience...

The quotes thing is strange, I'm on Python 3.13 so I can only assume it's a change between those versions. I've copied your approach so hopefully that will allow it to work properly in 3.11.

The provider_config["port"] error was a one-character typo in config: 4808ed1882 (diff-d0b18c8a8e)

v1.5.2 out now!

Thanks again for your patience... The quotes thing is strange, I'm on Python 3.13 so I can only assume it's a change between those versions. I've copied your approach so hopefully that will allow it to work properly in 3.11. The `provider_config["port"]` error was a one-character typo in config: https://git.ianrenton.com/ian/spothole/commit/4808ed1882c8158e9f107fd679330c209e66e8b1#diff-d0b18c8a8ec1e89227520ff528b0009b09fd4840 v1.5.2 out now!
Author

Thank you, it's working now!

Thank you, it's working now!
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ian/spothole#124
No description provided.