#4075·LightRAG

[Bug]: bedrock_complete ignores LLM_TIMEOUT, so GPT-6 Astra extraction calls hit botocore's 60 s read timeout

Author: kimnamuCreated Sep 24, 2026Updated Sep 24, 2026

Thanks for #3454, which made the API server pass LLM_TIMEOUT to the Bedrock client. That path works with GPT-6 Astra; the library path keeps timing out.

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

With LightRAG(llm_model_func=bedrock_complete, ...) (as in examples/unofficial-sample/lightrag_bedrock_demo.py), no timeout reaches bedrock_complete_if_cache, so the Bedrock client keeps botocore's 60 s read timeout. Non-streaming Converse sends nothing until the answer is complete, so longer calls are cut and restarted from scratch while the role queue waits LLM_TIMEOUT × 2. Raising LLM_TIMEOUT, the README's advice for slow models, does not help.

Astra's extraction calls on dense chunks took 45-75 s:

Library path, main @ 6702eea Read timeout Converse attempts cut at 60 s Document
Astra, 948-token chunk, 6 runs 60 s 7/7 once, 5/7 three times, 1/3 twice ❌ FAILED after 480 s once; ⚠️ PROCESSED after 156 to 415 s
Astra global. profile, same chunk 60 s 1/3 ⚠️ 165 s
Astra, 1184-token doc, 3 runs 60 s 4/8, 2/6, 0/4 ⚠️ 367 s, 230 s; ✅ 107 s
Astra, 948-token chunk, LLM_TIMEOUT=600 still 60 s 2/4 ⚠️ 228 s
Astra, 1184-token doc, llm_model_kwargs={"timeout": 240} 240 s 0/4 (longest call 75 s) ✅ 107 s
GPT-6 Sol and Luna, 948-token chunk 60 s 0/2 each (longest call 25 s, 35 s) ✅ 39 s, 77 s
API server LLM_BINDING=bedrock, Astra, 1184-token doc 240 s no timeout in the log ✅ 121 s

Steps to reproduce

Script: one 948-token chunk, logs each failed botocore attempt
python
# Library-path repro: LightRAG(llm_model_func=bedrock_complete) + GPT-6 Astra, one entity-dense chunk.
# Needs AWS_DEFAULT_REGION=us-east-1 and Bedrock credentials (AWS_BEARER_TOKEN_BEDROCK or SigV4).
import asyncio, shutil, time
import lightrag.llm.bedrock as B
from lightrag import LightRAG
from lightrag.base import DocStatus
from lightrag.llm.bedrock import bedrock_complete, bedrock_embed
from lightrag.utils import EmbeddingFunc


def _start(request=None, **_):
    request.context["t"] = time.perf_counter()


def _retry(attempts=None, caught_exception=None, request_dict=None, **_):
    if caught_exception is not None:
        print(f"Converse attempt {attempts}: {type(caught_exception).__name__} after "
              f"{time.perf_counter() - request_dict['context']['t']:.1f}s")


class LoggingSession(B.aioboto3.Session):  # only logs each botocore attempt
    def __init__(self, *a, **k):
        super().__init__(*a, **k)
        self.events.register("request-created.bedrock-runtime", _start)
        self.events.register("needs-retry.bedrock-runtime", _retry)


B.aioboto3.Session = LoggingSession

P = [("Ada Lovelace", "London", "the first published algorithm"), ("Charles Babbage", "London", "the Difference Engine"),
     ("Alan Turing", "Manchester", "the Automatic Computing Engine"), ("Grace Hopper", "Arlington", "COBOL"),
     ("John von Neumann", "Princeton", "EDVAC"), ("Konrad Zuse", "Berlin", "the Z3"), ("Tommy Flowers", "Bletchley Park", "Colossus"),
     ("Maurice Wilkes", "Cambridge", "EDSAC"), ("Kathleen Booth", "Birkbeck", "assembly language"), ("Dennis Ritchie", "Murray Hill", "C"),
     ("Ken Thompson", "Murray Hill", "Unix"), ("Barbara Liskov", "Cambridge Massachusetts", "CLU"), ("Niklaus Wirth", "Zurich", "Pascal"),
     ("Edsger Dijkstra", "Eindhoven", "the THE multiprogramming system"), ("Frances Allen", "Yorktown Heights", "optimizing compilers"),
     ("John Backus", "New York", "FORTRAN"), ("John McCarthy", "Stanford", "Lisp"), ("Tony Hoare", "Oxford", "Quicksort"),
     ("Donald Knuth", "Stanford", "TeX"), ("Bjarne Stroustrup", "Murray Hill", "C++"), ("Guido van Rossum", "Amsterdam", "Python"),
     ("James Gosling", "Santa Clara", "Java"), ("Alan Kay", "Palo Alto", "Smalltalk"), ("Adele Goldberg", "Palo Alto", "the Smalltalk-80 system"),
     ("Margaret Hamilton", "Cambridge Massachusetts", "the Apollo guidance software"), ("Tim Berners-Lee", "Geneva", "the World Wide Web"),
     ("Vint Cerf", "Stanford", "TCP/IP"), ("Robert Kahn", "Reston", "the Internet Protocol suite"), ("Linus Torvalds", "Helsinki", "Linux"),
     ("Richard Stallman", "Cambridge Massachusetts", "GNU"), ("Leslie Lamport", "Palo Alto", "Paxos")]
TEXT = " ".join(f"{p} worked in {c} and is known for {w}. {p} collaborated with {P[(i + 1) % len(P)][0]} "
                f"on ideas that influenced {P[(i + 2) % len(P)][2]}." for i, (p, c, w) in enumerate(P))  # 948 tokens, one chunk


async def main():
    shutil.rmtree("./rag_astra", ignore_errors=True)
    rag = LightRAG(working_dir="./rag_astra", llm_model_func=bedrock_complete, llm_model_name="us.openai.gpt-6-astra",
                   embedding_func=EmbeddingFunc(embedding_dim=1024, max_token_size=8192, func=bedrock_embed.func))
    await rag.initialize_storages()
    t0 = time.perf_counter()
    await rag.ainsert(TEXT)
    for status in (DocStatus.PROCESSED, DocStatus.FAILED):
        for doc in (await rag.doc_status.get_docs_by_statuses([status])).values():
            print(f"{status.value} after {time.perf_counter() - t0:.0f}s: {doc.error_msg or ''}")
    await rag.finalize_storages()


asyncio.run(main())

Expected Behavior

bedrock_complete uses LightRAG's LLM timeout when the caller passes none, as the API server does. Possible fix, keeping bedrock_complete_if_cache(timeout=None) on botocore's defaults as #3454 intended:

python
global_config = kwargs["hashing_kv"].global_config
model_name = global_config["llm_model_name"]
kwargs.setdefault("timeout", global_config.get("default_llm_timeout"))

An explicit timeout still wins. If you prefer SDK defaults for library callers, llm_model_kwargs={"timeout": ...} in the Bedrock sample works too. I'll open a PR with it and an offline regression test.

LightRAG Config Used

llm_model_func=bedrock_complete, llm_model_name="us.openai.gpt-6-astra"
embedding_func=EmbeddingFunc(embedding_dim=1024, max_token_size=8192, func=bedrock_embed.func)
LLM_TIMEOUT unset (240), llm_model_kwargs={}, default storages

Logs and screenshots

Script output on main, and the run that failed (harness with the same hooks)
# main @ 6702eea, stdout redirected (LightRAG's stderr line lands first)
ERROR:root:Bedrock converse timeout error: Read timeout on endpoint URL: "https://bedrock-runtime.us-east-1.amazonaws.com/model/us.openai.gpt-6-astra/converse"
Converse attempt 1: ReadTimeoutError after 60.4s
Converse attempt 2: ReadTimeoutError after 60.4s
Converse attempt 3: ReadTimeoutError after 60.4s
Converse attempt 4: ReadTimeoutError after 60.4s
Converse attempt 5: ReadTimeoutError after 60.4s
processed after 378s:

# same chunk, the run that failed
INFO: extract LLM func: 4 new workers initialized (Timeouts: Func: 240s, Worker: 480s, Health Check: 495s)
  t=  62.1s Converse attempt 1: ReadTimeoutError after 60.4s
  t= 123.0s Converse attempt 2: ReadTimeoutError after 60.4s
  t= 185.0s Converse attempt 3: ReadTimeoutError after 60.4s
  t= 247.1s Converse attempt 4: ReadTimeoutError after 61.2s
  t= 312.0s Converse attempt 5: ReadTimeoutError after 61.8s
ERROR:root:Bedrock converse timeout error: Read timeout on endpoint URL: "https://bedrock-runtime.us-east-1.amazonaws.com/model/us.openai.gpt-6-astra/converse"
  t= 376.6s Converse attempt 1: ReadTimeoutError after 60.4s
  t= 437.5s Converse attempt 2: ReadTimeoutError after 60.4s
WARNING: extract LLM func: Worker timeout for task 4567817408_43821.625028375 after 480s
ERROR: Failed to extract entities and relationships: C[1/1]: doc-30fe4a8fbde1d198846cefaa0dfe7194-chunk-000: extract LLM func: Worker execution timeout after 480s
ERROR: Traceback (most recent call last):
  File "lightrag/utils.py", line 2534, in wait_func
    result = await future
lightrag.utils.WorkerTimeoutError: Worker execution timeout after 480s
  ...
TimeoutError: C[1/1]: doc-30fe4a8fbde1d198846cefaa0dfe7194-chunk-000: extract LLM func: Worker execution timeout after 480s
  FAILED error_msg: C[1/1]: doc-30fe4a8fbde1d198846cefaa0dfe7194-chunk-000: extract LLM func: Worker execution timeout after 480s

Additional Information

  • LightRAG Version: main @ 6702eea (1.5.8)
  • Operating System: macOS
  • Python Version: 3.12 (aioboto3 15.5.0, botocore 1.40.61), us-east-1
  • Related Issues: #3454

I used Claude Code to trace the code path and run the checks.