Use this runbook when OpenClaw is running but memory RAG embeddings are down, or when session UI metadata shows a mismatched provider/model pair.
This was validated on 2026-03-01 in the Studio environment.
openclaw memory status --deepshows:Provider: none (requested: auto)Embeddings: unavailableNo API key found for provider "openai"
- TUI/session line shows invalid pair like
anthropic/gpt-5.3-codex openclaw health --jsonfails with gateway close1006
- OpenClaw CLI is installed and on PATH (
openclaw --version) - You have access to the OpenClaw config at
~/.openclaw/openclaw.json - You have a valid OpenAI API key available (or another supported embedding provider key)
Run these first:
openclaw doctor --non-interactive
openclaw gateway status
openclaw health --json
openclaw memory status --deepExpected healthy baseline:
gateway statusshowsRPC probe: okhealth --jsonhas"ok": truememory status --deepshows:Provider: openaiEmbeddings: readyVector: ready
jq '{
hasOpenAIKey:(.env.vars.OPENAI_API_KEY|type=="string" and (.|length>0)),
modelPrimary:.agents.defaults.model.primary
}' ~/.openclaw/openclaw.jsonIf hasOpenAIKey is false, set it.
If key exists in ~/.clawdbot/clawdbot.json, copy it:
KEY=$(jq -r '.env.vars.OPENAI_API_KEY // empty' ~/.clawdbot/clawdbot.json)
if [ -z "$KEY" ]; then
echo "OPENAI_API_KEY missing in ~/.clawdbot/clawdbot.json" >&2
exit 1
fi
openclaw config set --strict-json env.vars.OPENAI_API_KEY "\"$KEY\""Or set directly from shell env:
openclaw config set --strict-json env.vars.OPENAI_API_KEY "\"$OPENAI_API_KEY\""openclaw gateway restart
openclaw gateway statusIf restart gets interrupted:
openclaw gateway start
openclaw gateway statusopenclaw memory status --deep
openclaw memory search --query "nightly comm test" --jsonHealthy output should include:
Provider: openai (requested: auto)Model: text-embedding-3-smallEmbeddings: ready- A result from
memory/...inmemory search
This is usually stale/missing transcript metadata in session store.
openclaw sessions cleanup \
--dry-run \
--fix-missing \
--json \
--store ~/.openclaw/agents/main/sessions/sessions.jsonopenclaw sessions cleanup \
--enforce \
--fix-missing \
--json \
--store ~/.openclaw/agents/main/sessions/sessions.jsonopenclaw sessions --json | jq '
.sessions[] |
select(.key=="agent:main:main") |
{key,model,modelProvider,totalTokens,contextTokens}
'Expected:
model: gpt-5.3-codexmodelProvider: openai-codex
Run:
openclaw gateway status
openclaw health --json
openclaw memory status --deep
openclaw memory search --query "agent-to-agent communication test" --json
openclaw doctor --non-interactiveDeclare success when all are true:
- Gateway runtime is running and
RPC probe: ok - Health JSON has
"ok": true - Memory status shows
Embeddings: ready - Semantic memory query returns relevant file hits
- No blocking doctor errors for memory/gateway
openclaw config set ... OPENAI_API_KEYupdates config, but embeddings still fail until gateway restart completes.- Multiple gateway instances on the same port can cause restart loops and false negative probes.
- If CLI can not write
~/.openclaw(lockfile or EPERM), run commands in a shell with proper permissions. - Do not trust TUI model/provider labels if session store has missing transcripts. Run cleanup first.
- Never commit raw API keys to git.
- Never paste keys in Discord or shared channels.
- Validate key presence with boolean checks, not by printing values.