Repository navigation
Description
Environment
- OpenClaw version: 2026.6.1 (2e08f0f)
- OS: WSL2 Ubuntu 24.04 on Windows 11
- Node.js: v24.15.0
- Install method: npm global install
Configuration
Memory search configured to use SiliconFlow as an OpenAI-compatible embedding provider:
{
"agents": {
"defaults": {
"memorySearch": {
"provider": "openai",
"model": "BAAI/bge-large-zh-v1.5",
"remote": {
"baseUrl": "https://api.siliconflow.cn/v1",
"apiKey": "sk-..."
}
}
}
}
}SiliconFlow model added to models.providers:
{
"siliconflow": {
"api": "openai-completions",
"apiKey": "sk-...",
"baseUrl": "https://api.siliconflow.cn/v1",
"models": [
{
"api": "openai-completions",
"id": "BAAI/bge-large-zh-v1.5",
"name": "BGE Large Chinese 1.5",
"input": ["text"],
"contextWindow": 512,
"maxTokens": 512,
"reasoning": false
}
]
}
}Expected Behavior
openclaw memory index --force --agent main should successfully index memory files using SiliconFlow's embedding API.
Actual Behavior
Memory indexing fails with:
Memory index failed (main): openai embeddings failed: HTTP 400
{"code":20015,"message":"The parameter is invalid. Please check again.","data":null}
Key Findings from Debugging
1. Request Looks Correct
I added debug logging to dist/embedding-provider-CtNPrLQj.js (the createOpenAiEmbeddingProvider function) and dist/memory-core-host-engine-embeddings-BB4b09Jx.js (the postJson function). The debug output confirms:
[POSTJSON-DEBUG] url=https://api.siliconflow.cn/v1/embeddings
[POSTJSON-DEBUG] body={"model":"BAAI/bge-large-zh-v1.5","input":["...valid text..."]}
[POSTJSON-DEBUG] headers={"Content-Type":"application/json","Authorization":"Bearer sk-..."}
[POSTJSON-DEBUG] ssrfPolicy={"allowedHostnames":["api.siliconflow.cn"]}
[POSTJSON-DEBUG] res.status=400
The URL, headers, body, and model are all correct and match what works via direct HTTP clients.
2. Same Request Works Outside OpenClaw
The exact same HTTP request (same URL, same headers, same JSON body) sent via curl or Node.js fetch (undici) returns HTTP 200 with valid embeddings:
# curl test — SUCCEEDS (200)
curl -s -w "\nHTTP_CODE:%{http_code}" \
"https://api.siliconflow.cn/v1/embeddings" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-..." \
-d '{"model":"BAAI/bge-large-zh-v1.5","input":["# MEMORY.md content..."]}'
# → HTTP_CODE:200 ✅// Node.js undici test — SUCCEEDS (200)
const res = await fetch('https://api.siliconflow.cn/v1/embeddings', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-...'
},
body: JSON.stringify({ model: 'BAAI/bge-large-zh-v1.5', input: ['test'] })
});
// → Status: 200 ✅3. Intermittent Success Pattern
During testing with a local HTTP proxy intercepting requests:
- Some requests succeed (200), some fail (400) — often the first request fails
- Content that fails via openclaw succeeds when replayed via curl
- This suggests the issue is at the HTTP transport layer, not the API or content level
4. Request Flow
The call chain is:
MemoryIndexManager.loadProviderResult()→createEmbeddingProvider()- →
openAiMemoryEmbeddingProviderAdapter.create()→createOpenAiEmbeddingProvider() - →
fetchRemoteEmbeddingVectors()→postJson()→withRemoteHttpResponse() - →
fetchWithSsrFGuard()(indist/fetch-guard-B8N1GCBS.js)
The SSRF guard's fetchWithSsrFGuardInternal adds complex connection handling (dispatcher selection, proxy checks, DNS pinning). The hypothesis is that something in this guarded fetch pipeline modifies the HTTP request in a way that SiliconFlow's API rejects.
5. Also Fails with openai-compatible Provider
Setting memorySearch.provider to "siliconflow" (which auto-resolves to "openai-compatible") also fails with the same 400 error. The openai-compatible code path in dist/registry-BVye-IRt.js has its own postEmbeddingRequest function that uses fetchWithSsrFGuard directly.
Workaround
Setting memorySearch.provider to "none" (FTS-only mode, no vector embeddings) allows memory indexing to succeed:
{
"memorySearch": {
"provider": "none"
}
}This provides keyword-based memory search but lacks semantic/vector search capabilities.
Possible Root Cause Hypothesis
The fetchWithSsrFGuard in dist/fetch-guard-B8N1GCBS.js may be:
- Adding/modifying HTTP headers that SiliconFlow rejects
- Using HTTP/2 connection reuse that causes state issues
- Applying a dispatcher/proxy agent that modifies the TCP/TLS connection behavior
- Setting
transfer-encoding: chunkedvscontent-lengthin a way SiliconFlow doesn't expect
Steps to Reproduce
- Install OpenClaw 2026.6.1
- Configure memorySearch with
provider: "openai", modelBAAI/bge-large-zh-v1.5, andremote.baseUrlpointing tohttps://api.siliconflow.cn/v1 - Create a memory file in
~/.openclaw/workspace/memory/ - Run
openclaw memory index --force --agent main - Observe HTTP 400 error from SiliconFlow
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 8, 2026
Codex review: this still needs some work.
Summary
The reporter’s corrected input-limit diagnosis remains actionable: neither embedding route declares this model’s capacity, and the proposed fix closed unmerged; newer chunking prevents claiming a verified current SiliconFlow failure.
Reproducibility: Source confirms missing capacity declarations, but no current failing input establishes that the reported SiliconFlow HTTP 400 persists after chunking changes; no tests or live requests were run.
Maintainer decision needed
Next step
Establish a failing current-version indexing input and choose the capacity contract before repairing both embedding adapters.
Review details
Best possible solution:
Apply one agreed, destination-bound input-budget contract across both adapters while retaining native model limits and shared chunk enforcement.
Do we have a high-confidence way to reproduce the issue?
Source confirms missing capacity declarations, but no current failing input establishes that the reported SiliconFlow HTTP 400 persists after chunking changes; no tests or live requests were run.
Is this the best way to solve the issue?
The earlier adapter-only proposal is incomplete and prefers an output-token field; a shared capacity contract tested through both real provider routes is safer.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 5462f7f14643.
Label changes
Label changes:
No label changes.
Label justifications:
P2: The report concerns semantic indexing with a particular compatible embedding model in an advanced configuration workflow.impact:auth-provider: The affected boundary is embedding provider/model configuration and input capacity.Evidence reviewed
What I checked:
extensions/openai/embedding-provider.ts:63, 5462f7f14643)src/plugins/openai-compatible-embedding-provider.ts:505, 5462f7f14643)packages/memory-host-sdk/src/host/embedding-model-limits.ts:5, 5462f7f14643)packages/normalization-core/src/cjk-chars.ts:1, 5462f7f14643)src/config/types.models.ts:47, 5462f7f14643)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed October 15, 2026, 10:57 PM ET / October 16, 2026, 02:57 UTC.
xiangcaoni commentedon Jun 8, 2026
更正:根因不是
fetchWithSsrFGuard经过深入调试,发现真正的根因是 token 限制配置缺失,而非 HTTP pipeline 兼容性问题。
真实根因
BAAI/bge-large-zh-v1.5的 token 上限是 512 tokens(不是 8192)OPENAI_MAX_INPUT_TOKENS只包含 OpenAI 原生模型(text-embedding-3-small、text-embedding-ada-002等),不包含第三方兼容模型maxInputTokens不会被设置,导致enforceEmbeddingMaxInputTokens使用默认值 8192"The parameter is invalid"为什么之前误判为
fetchWithSsrFGuard因为文本长度不一,有的 ≤512 tokens(成功),有的 >512 tokens(失败),表现为「间歇性」失败,且 curl 测试时恰好用的都是短文本。
本地临时修复
在
OPENAI_MAX_INPUT_TOKENS中添加:建议上游修复方案
OPENAI_MAX_INPUT_TOKENS中添加常见第三方 embedding 模型的 token 限制resolveEmbeddingMaxInputTokens回退时读取模型的contextWindow/maxTokens配置,而不是硬编码 8192maxInputTokens并重试环境
17 remaining items
openclaw-barnacle commentedon Oct 23, 2026
This issue has been automatically marked as stale after 7 days without qualifying human activity.
Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.
steipete commentedon Oct 24, 2026
Thanks for filing this. We're closing older issues that no longer look actionable on current
main.The root cause turned out to be the model's 512-token input limit, and embedding chunking has changed since 2026.6.1; we couldn't confirm the HTTP 400 still happens on current main. If SiliconFlow embeddings still fail on a recent release, please open a fresh issue with the request size and error.