microsoft / microsoft/graphrag

AzureBlobStorage.set() logs "Error setting key %s: %s" with only one argument, so the failure is never logged

Open Beginner friendly
#2,541 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
36k
Forks
3.8k
Avg merge
20h 40m
Merged PRs (30d)
4

Description

Do you need to file an issue?
  • I have searched the existing issues and this bug is not already filed.
  • My model is hosted on OpenAI or Azure. If not, please look at the "model providers" issue and don't file a new one here.
  • I believe this is a legitimate bug, not just a question or feature request.
Describe the bug

AzureBlobStorage.set() logs its failure with a format string that has two
%s placeholders but supplies one argument:

https://github.com/microsoft/graphrag/blob/main/packages/graphrag-storage/graphrag_storage/azure_blob_storage.py#L195

except Exception:
    logger.exception("Error setting key %s: %s", key)

logging raises TypeError: not enough arguments for format string while
rendering the record, catches it internally, drops the record, and writes
--- Logging error --- plus a traceback to stderr instead.

The net effect is that when a blob write fails, the diagnostic that was written
specifically for that case never reaches the configured log handlers — exactly
the moment the log is needed. The exception is swallowed by the bare except,
so the failed write is otherwise silent.

Every sibling handler uses one placeholder and one argument, e.g. lines 176 and
251 in the same file (logger.warning("Error getting key %s", key)) and the
four handlers in azure_cosmos_storage.py
(logger.exception("Error reading item %s", namespaced) etc.). This one call
site is the only one with a stray : %s.

Steps to reproduce

Any failing blob write reaches it; the call shape reproduces standalone:

import logging
logging.basicConfig()
log = logging.getLogger("repro")
try:
    raise ValueError("blob upload failed")
except Exception:
    log.exception("Error setting key %s: %s", "output/entities.parquet")

Observed — no log record is emitted, and stderr gets:

--- Logging error ---
Traceback (most recent call last):
  File ".../logging/__init__.py", line 1160, in emit
    msg = self.format(record)
  ...
TypeError: not enough arguments for format string

Dropping the extra : %s emits the intended record (with the traceback that
logger.exception appends anyway).

Expected Behavior

The failure is logged through the normal handlers, like every sibling handler
in the storage package.

GraphRAG Config Used

Not config-dependent — any configuration using the Azure Blob storage backend.

Logs and screenshots

Included above.

Additional Information
  • GraphRAG Version: main (packages/graphrag-storage)
  • Python Version: any supported version (stdlib logging behaviour)

Happy to send the one-line PR.

🤖 Generated with Claude Code

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.

Research direction

Open packages/graphrag-storage/graphrag_storage/azure_blob_storage.py and inspect AzureBlobStorage.set() around line 195, comparing its exception logging with the sibling handlers cited in the issue. Confirm the corrected call emits a normal record through configured handlers when a blob write fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
backend, cloud
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.