microsoft/graphrag · error · ValueError

request_id needs to be passed as a keyword argument

Error message

request_id needs to be passed as a keyword argument

What it means

EmbeddingThreadRunner's _process_input helper requires a truthy request_id keyword so embedding requests can be correlated with their outputs through the internal queues. Omitting it or passing an empty string raises ValueError.

Source

Thrown at packages/graphrag-llm/graphrag_llm/threading/embedding_thread_runner.py:183

        callback: ThreadedLLMEmbeddingResponseHandler,
    ):
        while True and not quit_process_event.is_set():
            try:
                data = output_queue.get(timeout=1)
            except Empty:
                continue
            if data is None:
                break
            request_id, response = data
            response = callback(request_id, response)

            if asyncio.iscoroutine(response):
                response = asyncio.run(response)

    def _process_input(request_id: str, **kwargs: Unpack["LLMEmbeddingArgs"]):
        if not request_id:
            msg = "request_id needs to be passed as a keyword argument"
            raise ValueError(msg)
        input_queue.put((request_id, kwargs))

    handle_response_thread = threading.Thread(
        target=_process_output,
        args=(quit_process_event, output_queue, response_handler),
    )
    handle_response_thread.start()

    def _cleanup():
        for _ in threads:
            input_queue.put(None)

        for thread in threads:
            while thread.is_alive():
                thread.join(timeout=1)

        output_queue.put(None)

View on GitHub (pinned to f40e9a26ce)

Solutions

  1. Always pass a non-empty request_id keyword argument
  2. Thread request_id through adapter/wrapper layers that forward kwargs
  3. Use uuid4().hex when no natural correlation id exists

Example fix

# before
runner(input=["hello world"])

# after
runner(request_id="embed-001", input=["hello world"])
Defensive patterns

Strategy: validation

Validate before calling

request_id = request_id or uuid.uuid4().hex
assert request_id, "request_id required"
runner(request_id=request_id, **kwargs)

Type guard

null

Try / catch

try:
    runner(request_id=rid, **kwargs)
except ValueError as e:
    if 'request_id' in str(e):
        rid = uuid.uuid4().hex
        runner(request_id=rid, **kwargs)
    else:
        raise

Prevention

When it happens

Trigger: Calling the embedding runner's input function with only LLMEmbeddingArgs kwargs (e.g. runner(input=['text'])) without request_id.

Common situations: Adapting code that used a non-threaded embed() call, generic **kwargs forwarding that drops request_id, or ids generated from optional fields that end up as ''.

Related errors


AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27). Data as JSON: /api/errors/b8c09c1478f98e93. Report an issue: GitHub.