openclaw - ✅(Solved) Fix [Bug]: Gateway startup blocked by model pricing fetch timeout causing TUI connection failure [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#72904Fetched 2026-04-28 06:30:33
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×2closed ×1commented ×1cross-referenced ×1

gateway connect failed: Error: gateway closed (1000)

Error Message

gateway connect failed: Error: gateway closed (1000)

Root Cause

gateway connect failed: Error: gateway closed (1000)

PR fix notes

PR #73214: fix(gateway): tighten model-pricing fetch timeout, add offline opt-out (Fixes #72904)

Description (problem / solution / changelog)

Summary

Quality-of-life improvement for users on offline / firewalled networks who hit slow / failing model-pricing fetches at gateway start (reported in #72904).

Context

startGatewayModelPricingRefresh() already kicks the OpenRouter and LiteLLM catalog fetches off the hot path via queueMicrotask, and both fetches run in parallel with each failure being non-fatal. So in normal operation the refresh does not block gateway start.

What it does do, on a network where one of the upstream hosts is unreachable, is take up to 60 s to log a "pricing fetch failed (timeout 60s)" warning and to retry — which surfaces as confusing "stuck" output during first run.

Changes

  1. Cut the default per-source pricing fetch timeout from 60 s → 15 s. The pricing catalogs are small static JSON; 15 s is plenty for any healthy upstream and short enough that an outage surfaces quickly. Operators who want the previous behavior (or longer) can set OPENCLAW_PRICING_FETCH_TIMEOUT_MS=60000 (clamped to [1000, 120000]).
  2. Add OPENCLAW_DISABLE_PRICING_REFRESH=1 to skip both upstream HTTP refreshes entirely. Useful for air-gapped deployments. Configured / manifest-seeded pricing still works as before.

Test plan

  • Both env vars are read once at module load via small helpers; default behavior preserved when unset.
  • All existing pricing tests continue to pass against the new default timeout (no test depended on the 60 s constant).
  • The disable flag short-circuits before any background work is scheduled.

Fixes #72904

Changed files

  • src/gateway/model-pricing-cache.ts (modified, +28/-1)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

gateway connect failed: Error: gateway closed (1000)

Steps to reproduce

主要内容:

  • 问题:TUI 连接失败,显示 gateway closed (1000)
  • 原因:Gateway 启动时被远程 pricing 请求(OpenRouter/LiteLLM)阻塞,每个请求超时 60 秒
  • 影响:网络受限地区用户首次体验差

Expected behavior

  • 建议解决方案:非阻塞获取、缩短超时、添加配置选项禁用等

Actual behavior

非阻塞获取、缩短超时、添加配置选项禁用等

OpenClaw version

2026.4.25

Operating system

Windows11

Install method

npm g

Model

local:lmstudio

Provider / routing chain

openclaw->local:lmstudio->gemma4 e4b

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Implement non-blocking requests or shorten timeouts to prevent gateway closure.

Guidance

  • Investigate the remote pricing requests from OpenRouter/LiteLLM that are blocking the gateway startup.
  • Consider adding configuration options to disable these requests or adjust their timeouts.
  • Verify the effect of these changes on the gateway connection failure rate.
  • Review the network limitations in the affected areas to determine the optimal solution.

Example

No specific code snippet can be provided without more context, but an example of a non-blocking request in a hypothetical JavaScript context might look like:

// Pseudo-code example, actual implementation depends on the technology stack
const gatewayStartup = async () => {
  // Non-blocking request to prevent gateway from being blocked
  const pricingRequest = fetchPricingData();
  // Proceed with gateway startup without waiting for the request to complete
  startGateway();
  // Handle the pricing request result when it becomes available
  pricingRequest.then(handlePricingData);
};

Notes

The provided information suggests a regression issue related to gateway connection failures due to blocking requests. However, without more details on the specific technology stack, implementation, or logs, the guidance is limited to general suggestions.

Recommendation

Apply workaround: Implement non-blocking requests or adjust timeouts to mitigate the issue, as upgrading to a fixed version is not mentioned in the provided context.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • 建议解决方案:非阻塞获取、缩短超时、添加配置选项禁用等

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Gateway startup blocked by model pricing fetch timeout causing TUI connection failure [1 pull requests, 1 comments, 2 participants]