openclaw - 💡(How to fix) Fix Bug: memory-core sync fails with CredentialsProviderError despite OLLAMA_API_KEY set (distinct from #62282) [1 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#70157Fetched 2026-04-23 07:28:37
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Error Message

memory sync failed (session-start): CredentialsProviderError: Could not load credentials from any providers memory sync failed (search): CredentialsProviderError: Could not load credentials from any providers memory sync failed (watch): CredentialsProviderError: Could not load credentials from any providers

Root Cause

  1. The ollama memory embedding provider IS registered and appears in active-memory logs as working
  2. The failure occurs specifically in MemoryIndexManager.loadProviderResult()createEmbeddingProvider()getAdapter(provider) path used by memory-core sync
  3. The Ollama memory embedding adapter's create() function calls buildApiKeyCredential(OLLAMA_PROVIDER_ID, result.credential, ...) where result.credential comes from resolveOllamaDiscoveryResult()
  4. resolveOllamaDiscoveryResult() attempts to get credentials via the auth profile resolution chain
  5. When the auth chain fails to resolve (even with OLLAMA_API_KEY set), it throws CredentialsProviderError

The key finding: OLLAMA_API_KEY=ollama-local is set in the process environment and active-memory works fine with the same Ollama endpoint, but memory-core sync fails. This suggests two different credential resolution paths:

  • active-memory → uses ollama provider directly via api.runtime.chat() — succeeds
  • memory-core sync → uses MemoryIndexManager which goes through createEmbeddingProvider()ollamaMemoryEmbeddingProviderAdapter.create() → auth chain — fails

The difference may be that active-memory uses the OpenClaw inference plugin's Ollama integration (which bypasses auth profiles), while memory-core uses the dedicated memory embedding provider adapter which requires proper auth profile resolution.

Fix Action

Fix / Workaround

The OLLAMA_API_KEY=ollama-local workaround (setting any non-empty value) was attempted but did not resolve the issue — the problem is not the API key value itself but the credential resolution chain failing to find/produce a valid credential object for the memory embedding provider adapter path.

Code Example

memory sync failed (session-start): CredentialsProviderError: Could not load credentials from any providers
memory sync failed (search): CredentialsProviderError: Could not load credentials from any providers
memory sync failed (watch): CredentialsProviderError: Could not load credentials from any providers
RAW_BUFFERClick to expand / collapse

Bug Description

On every gateway startup and periodically during runtime, the memory-core plugin logs:

memory sync failed (session-start): CredentialsProviderError: Could not load credentials from any providers
memory sync failed (search): CredentialsProviderError: Could not load credentials from any providers
memory sync failed (watch): CredentialsProviderError: Could not load credentials from any providers

This is distinct from the more commonly reported Unknown memory embedding provider: ollama error (see #62282, #63681). In our case the ollama provider IS registered and visible (active-memory works using the same endpoint), but the memory-core sync path fails to obtain credentials.

Environment

  • OpenClaw version: 2026.4.21 (npm), gateway running 2026.4.14+ (see uptime)
  • Ollama: running at http://winhost:11434 (no auth, local)
  • Memory embedding model: qwen3-embedding:0.6b (available in Ollama)
  • memorySearch.provider: ollama
  • OLLAMA_API_KEY: set to ollama-local as env var (satisfies any non-empty key check)
  • OS: WSL2 / Linux

Steps to Reproduce

  1. Configure memorySearch.provider = "ollama" and OLLAMA_API_KEY=ollama-local in environment
  2. Start gateway or observe after restart
  3. Error appears within seconds on session-start sync and periodically on search/bootstrap

Expected Behavior

Memory sync completes without credential errors. Ollama local instances require no API key.

Actual Behavior

CredentialsProviderError: Could not load credentials from any providers — the memory embedding provider is found but cannot produce credentials.

Root Cause Analysis

  1. The ollama memory embedding provider IS registered and appears in active-memory logs as working
  2. The failure occurs specifically in MemoryIndexManager.loadProviderResult()createEmbeddingProvider()getAdapter(provider) path used by memory-core sync
  3. The Ollama memory embedding adapter's create() function calls buildApiKeyCredential(OLLAMA_PROVIDER_ID, result.credential, ...) where result.credential comes from resolveOllamaDiscoveryResult()
  4. resolveOllamaDiscoveryResult() attempts to get credentials via the auth profile resolution chain
  5. When the auth chain fails to resolve (even with OLLAMA_API_KEY set), it throws CredentialsProviderError

The key finding: OLLAMA_API_KEY=ollama-local is set in the process environment and active-memory works fine with the same Ollama endpoint, but memory-core sync fails. This suggests two different credential resolution paths:

  • active-memory → uses ollama provider directly via api.runtime.chat() — succeeds
  • memory-core sync → uses MemoryIndexManager which goes through createEmbeddingProvider()ollamaMemoryEmbeddingProviderAdapter.create() → auth chain — fails

The difference may be that active-memory uses the OpenClaw inference plugin's Ollama integration (which bypasses auth profiles), while memory-core uses the dedicated memory embedding provider adapter which requires proper auth profile resolution.

Code Locations

  • dist/memory-embedding-provider-runtime-hFl2REG1.jsgetMemoryEmbeddingProvider() and listMemoryEmbeddingProviders()
  • dist/manager-ChtEZeo0.js:168createEmbeddingProvider()
  • dist/extensions/ollama/index.js:13-75ollamaMemoryEmbeddingProviderAdapter.create() with buildApiKeyCredential()
  • dist/provider-auth-helpers-_LvigNEb.js:34resolveApiKeySecretInput()
  • dist/dreaming-DA2EhSBZ.js:1465-1478reconcileManagedDreamingCron() where error surfaces

Existing Related Issues

  • #62282 — Ollama embedding broke in 2026.4.5 (Unknown memory embedding provider: ollama)
  • #63681 — CLI memory index fails with Unknown memory embedding provider: ollama (CLI vs gateway difference)
  • #19943 — openclaw doctor false positive for memory embeddings
  • #21894 — Memory search silently disabled with no user notification
  • #66452 — Memory embedding provider normalization (mentioned in 2026.4.20 changelog)

Additional Context

The OLLAMA_API_KEY=ollama-local workaround (setting any non-empty value) was attempted but did not resolve the issue — the problem is not the API key value itself but the credential resolution chain failing to find/produce a valid credential object for the memory embedding provider adapter path.

Suggested Fix

  1. Investigate why ollamaMemoryEmbeddingProviderAdapter.create() fails to resolve credentials when OLLAMA_API_KEY is set, while active-memory's Ollama calls succeed
  2. Consider using the same Ollama invocation path for memory embeddings as active-memory uses
  3. Alternatively: document that Ollama local instances require explicit auth profile setup for memory-core (separate from the OLLAMA_API_KEY env var)

extent analysis

TL;DR

The most likely fix involves modifying the credential resolution chain for the ollamaMemoryEmbeddingProviderAdapter to correctly handle the OLLAMA_API_KEY environment variable or using the same Ollama invocation path as active-memory.

Guidance

  1. Investigate the ollamaMemoryEmbeddingProviderAdapter.create() method: Verify how it resolves credentials and why it fails when OLLAMA_API_KEY is set.
  2. Compare credential resolution paths: Study the differences between the credential resolution chains used by active-memory and memory-core sync to identify why one succeeds and the other fails.
  3. Consider auth profile setup for Ollama local instances: Determine if explicit auth profile setup is required for memory-core when using Ollama local instances, separate from the OLLAMA_API_KEY environment variable.
  4. Review related issues for insights: Examine issues like #62282, #63681, and #66452 for potential clues on how to resolve the credential resolution issue.

Example

No specific code snippet can be provided without modifying the existing codebase, but the investigation should focus on the ollamaMemoryEmbeddingProviderAdapter.create() method and its interaction with the auth profile resolution chain.

Notes

The fix may require changes to how credentials are resolved for the ollamaMemoryEmbeddingProviderAdapter or adapting the memory-core sync path to use the same successful credential resolution method as active-memory. The OLLAMA_API_KEY environment variable's role in this process needs clarification.

Recommendation

Apply a workaround by investigating and potentially modifying the ollamaMemoryEmbeddingProviderAdapter to correctly handle the OLLAMA_API_KEY environment variable, as the root cause seems to be related to credential resolution differences between active-memory and memory-core sync.

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