{"record":{"id":"0fee8e5f32c2defc","repo":"NousResearch/hermes-agent","slug":"provider-has-been-unresponsive-no-response-receiv","errorCode":null,"errorMessage":"Provider has been unresponsive (no response received) for {_streak} consecutive stale attempts — aborting this call to avoid an indefinite stall. Switch models or start a new session, then retry.","messagePattern":"Provider has been unresponsive \\(no response received\\) for (.+?) consecutive stale attempts — aborting this call to avoid an indefinite stall\\. Switch models or start a new session, then retry\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/chat_completion_helpers.py","lineNumber":386,"sourceCode":"        logger.debug(\"stale status buffering failed\", exc_info=True)\n\n\ndef _touch_stale_kill_activity(agent, elapsed: float) -> None:\n    try:\n        agent._touch_activity(\n            f\"stale non-streaming call killed after {int(elapsed)}s\"\n        )\n    except Exception:\n        logger.debug(\"stale activity touch failed\", exc_info=True)\n\n\ndef _check_stale_giveup(agent) -> None:\n    \"\"\"Raise immediately when the consecutive-stale streak is past the\n    give-up threshold — no network attempt, no stale-timeout wait.\"\"\"\n    _giveup = env_int(\"HERMES_STREAM_STALE_GIVEUP\", 5)\n    _streak = _stale_streak(agent)\n    if _giveup > 0 and _streak >= _giveup:\n        raise RuntimeError(\n            \"Provider has been unresponsive (no response received) for \"\n            f\"{_streak} consecutive stale attempts — aborting this call to \"\n            \"avoid an indefinite stall. Switch models or start a new \"\n            \"session, then retry.\"\n        )\n\n\ndef _derive_stream_stale_timeout(agent, api_kwargs: dict) -> float:\n    \"\"\"Stale-stream patience for a provider that is never a local endpoint.\n\n    Mirrors the main streaming path's derivation — provider config → env base\n    → context-size scaling → reasoning-model floor — minus the local-endpoint\n    ``float('inf')``/900s disable branch, which cannot apply to Bedrock (its\n    endpoint is always the AWS cloud). Factored so the Bedrock streaming\n    watchdog shares the exact same patience budget as the OpenAI/Anthropic\n    stale-stream detector below.\n    \"\"\"\n    _cfg_stale = get_provider_stale_timeout(agent.provider, agent.model)","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/chat_completion_helpers.py#L368-L404","documentation":"Cross-turn stale-call circuit breaker (#58962): the agent tracks _consecutive_stale_streams, incremented on every stale kill and reset only when a call completes or the provider is swapped. Past HERMES_STREAM_STALE_GIVEUP (default 5) consecutive stale attempts, _check_stale_giveup() raises immediately — no network attempt, no stale-timeout wait — to stop a session wedged against an unresponsive provider from looping forever (observed 494 consecutive failures over days).","triggerScenarios":"Five (default) consecutive API calls each stalled with no response bytes until the stale detector killed them; the next call then aborts instantly at the pre-flight check in agent/chat_completion_helpers.py:386.","commonSituations":"Provider outage or hard-hanging endpoint; a proxy accepting connections but never responding; rate-limited endpoint that holds connections open; switching models resolves it because the streak measured the OLD provider.","solutions":["Switch models/providers (`hermes model`) — swapping the provider resets the streak.","Start a new session, then retry.","Fix the underlying connectivity: check the provider status page, base_url, proxy.","As a last resort for controlled environments, raise HERMES_STREAM_STALE_GIVEUP (or set 0 to disable) — understand this re-enables the indefinite-stall loop the breaker exists to stop."],"exampleFix":"# temporary, diagnostics only\nexport HERMES_STREAM_STALE_GIVEUP=10","handlingStrategy":"fallback","validationCode":"from agent.chat_completion_helpers import _stale_streak\nif _stale_streak(agent) >= 4:  # one below default give-up of 5\n    switch_to_backup_provider_before_next_call()","typeGuard":null,"tryCatchPattern":"try:\n    response = call_model(...)\nexcept RuntimeError as e:\n    if \"consecutive stale attempts\" in str(e):\n        agent.switch_model(backup_provider)  # resets the streak\n        response = call_model(...)","preventionTips":["Configure a fallback model so `hermes model` swaps are one step.","Watch for repeated stale kills and act on the first one, not the fifth.","Do not raise HERMES_STREAM_STALE_GIVEUP in production — it re-enables the multi-day stall this breaker prevents."],"tags":["streaming","circuit-breaker","timeout","provider"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}