openclaw - ✅(Solved) Fix Ollama discovery: log connection failures at debug level, not warn [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#49988Fetched 2026-04-08 01:00:31
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
cross-referenced ×2commented ×1referenced ×1

Error Message

[agents/model-providers] Failed to discover Ollama models: TypeError: fetch failed

Fix Action

Fixed

PR fix notes

PR #2: fix: change Ollama connection failure log level from warn to debug

Description (problem / solution / changelog)

Summary

Change the log level for Ollama connection failures from warn to debug since local Ollama not running is a common scenario.

Changes

  • src/agents/models-config.providers.discovery.ts: Changed log level from warn to debug

Closes #49988

Changed files

  • src/agents/models-config.providers.discovery.ts (modified, +2/-2)
  • src/daemon/schtasks.ts (modified, +5/-2)

Code Example

[agents/model-providers] Failed to discover Ollama models: TypeError: fetch failed
RAW_BUFFERClick to expand / collapse

Problem

On gateway restart, if Ollama is not running locally (or is on a remote host like macstudio), the startup log shows:

[agents/model-providers] Failed to discover Ollama models: TypeError: fetch failed

This is logged at warn level unconditionally, even when the failure is simply "Ollama isn't on localhost" or "Ollama isn't up yet" — both totally expected conditions.

Location

src/agents/models-config.providers.discovery.tsdiscoverOllamaModels()

The catch block calls log.warn() for all errors including network-level ones like ECONNREFUSED / fetch failed.

Suggested Fix

Downgrade connection-level errors (fetch failed, ECONNREFUSED, ECONNRESET, AbortError from the 5s timeout) to log.debug() — these are expected when Ollama isn't configured locally. Only log warn for unexpected errors (e.g. bad response format, HTTP 5xx).

Alternatively, pass quiet: true during initial startup discovery so the error is silenced entirely on first boot.

Impact

Causes user confusion and noisy logs on every gateway restart when Ollama is configured on a remote host (e.g. a separate Mac Studio running Ollama/LiteLLM on a local network).

extent analysis

Fix Plan

To address the issue, we will modify the discoverOllamaModels() function in src/agents/models-config.providers.discovery.ts to downgrade connection-level errors to log.debug() and only log unexpected errors at warn level.

Code Changes

// In discoverOllamaModels() function
try {
  // existing code to discover Ollama models
} catch (error) {
  if (error instanceof Error && [
    'ECONNREFUSED',
    'ECONNRESET',
    'AbortError',
    'fetch failed',
  ].includes(error.message)) {
    log.debug(`Failed to discover Ollama models: ${error.message}`);
  } else {
    log.warn(`Failed to discover Ollama models: ${error.message}`);
  }
}

Alternatively, you can pass quiet: true during initial startup discovery:

// In discoverOllamaModels() function
if (quiet) {
  try {
    // existing code to discover Ollama models
  } catch (error) {
    log.debug(`Failed to discover Ollama models: ${error.message}`);
  }
} else {
  // existing code to handle errors
}

Verification

To verify the fix, restart the gateway and check the logs for the warn message. The message should no longer appear for connection-level errors.

Extra Tips

  • Make sure to test the fix with different scenarios, such as Ollama running locally and remotely.
  • Consider adding a retry mechanism to handle temporary connection issues.
  • Review the logging configuration to ensure that debug-level logs are properly handled and do not clutter the logs.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING