Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

_logger.py: KeyError:5 [bugfix] [patch]

Open Beginner friendly
#1,778 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
80/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

The issue is in llama_cpp/_logger.py. Look for the dictionary GGML_LOG_LEVEL_TO_LOGGING_LEVEL and add the missing key 5 with the value logging.FATAL. After editing, test by running the code that triggers the logging callback to ensure the KeyError is resolved.

Written by the indexing model from the issue text.

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Current Behavior

KeyError: 5
Exception ignored on calling ctypes callback function: <function llama_log_callback at 0x7f1ab2545c60>
Traceback (most recent call last):
File "/home/k/Downloads/src/llama-cpp-python/llama_cpp/_logger.py", line 32, in llama_log_callback
if logger.level <= GGML_LOG_LEVEL_TO_LOGGING_LEVEL[level]:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
(repeats)

Environment and Context

Easy fix: in llama-cpp-python/llama_cpp/_logger.py

Add the key (5)

GGML_LOG_LEVEL_TO_LOGGING_LEVEL = {
0: logging.CRITICAL,
1: logging.INFO,
2: logging.WARNING,
3: logging.ERROR,
4: logging.DEBUG,
++++++ 5: logging.FATAL
}

Dominant language
Python
Stars
10.6k
Forks
1.5k
Avg merge
6h 43m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from abetlen/llama-cpp-python

All issues in abetlen/llama-cpp-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.