{"record":{"id":"b8c09c1478f98e93","repo":"microsoft/graphrag","slug":"request-id-needs-to-be-passed-as-a-keyword-argumen-b8c09c","errorCode":null,"errorMessage":"request_id needs to be passed as a keyword argument","messagePattern":"request_id needs to be passed as a keyword argument","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-llm/graphrag_llm/threading/embedding_thread_runner.py","lineNumber":183,"sourceCode":"        callback: ThreadedLLMEmbeddingResponseHandler,\n    ):\n        while True and not quit_process_event.is_set():\n            try:\n                data = output_queue.get(timeout=1)\n            except Empty:\n                continue\n            if data is None:\n                break\n            request_id, response = data\n            response = callback(request_id, response)\n\n            if asyncio.iscoroutine(response):\n                response = asyncio.run(response)\n\n    def _process_input(request_id: str, **kwargs: Unpack[\"LLMEmbeddingArgs\"]):\n        if not request_id:\n            msg = \"request_id needs to be passed as a keyword argument\"\n            raise ValueError(msg)\n        input_queue.put((request_id, kwargs))\n\n    handle_response_thread = threading.Thread(\n        target=_process_output,\n        args=(quit_process_event, output_queue, response_handler),\n    )\n    handle_response_thread.start()\n\n    def _cleanup():\n        for _ in threads:\n            input_queue.put(None)\n\n        for thread in threads:\n            while thread.is_alive():\n                thread.join(timeout=1)\n\n        output_queue.put(None)\n","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-llm/graphrag_llm/threading/embedding_thread_runner.py#L165-L201","documentation":"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.","triggerScenarios":"Calling the embedding runner's input function with only LLMEmbeddingArgs kwargs (e.g. runner(input=['text'])) without request_id.","commonSituations":"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 ''.","solutions":["Always pass a non-empty request_id keyword argument","Thread request_id through adapter/wrapper layers that forward kwargs","Use uuid4().hex when no natural correlation id exists"],"exampleFix":"# before\nrunner(input=[\"hello world\"])\n\n# after\nrunner(request_id=\"embed-001\", input=[\"hello world\"])","handlingStrategy":"validation","validationCode":"request_id = request_id or uuid.uuid4().hex\nassert request_id, \"request_id required\"\nrunner(request_id=request_id, **kwargs)","typeGuard":"null","tryCatchPattern":"try:\n    runner(request_id=rid, **kwargs)\nexcept ValueError as e:\n    if 'request_id' in str(e):\n        rid = uuid.uuid4().hex\n        runner(request_id=rid, **kwargs)\n    else:\n        raise","preventionTips":["Always generate request_id first: rid = uuid4().hex","Type your wrapper signature as (request_id: str, **kwargs: Unpack[LLMEmbeddingArgs]) so the requirement is visible"],"tags":["threading","request-id","validation","embedding"],"backgroundTag":"missing-required-keyword-argument","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}