TencentCloud/TencentDB-Agent-Memory · error · LlmResolveError
llm.provider=proxy 且 llm.proxy.useMemorySystemUserKey=true 需
Error message
llm.provider=proxy 且 llm.proxy.useMemorySystemUserKey=true 需要 metadata.systemUser.memory 完整配置(userId + userKey),当前缺失
What it means
With provider=proxy, the default behavior (proxy.useMemorySystemUserKey defaults to true) is to authenticate proxy calls using the memory system user credentials from metadata.systemUser.memory. If that config object is absent (resolve found no complete userId + userKey pair), the resolver throws this LlmResolveError instead of sending unauthenticated proxy calls.
Source
Thrown at MemoryCore/src/gateway/llm-resolver.ts:70
// provider=proxy 的校验
if (!llm.baseUrl) {
throw new LlmResolveError(
"llm.provider=proxy 需要 llm.baseUrl 指向 context_proxy 根 URL (如 http://127.0.0.1:8096)",
);
}
if (!instanceId || !instanceId.trim()) {
throw new LlmResolveError(
"llm.provider=proxy 需要 instanceId,但 core 当前 instanceId 为空 —— " +
"service 模式下确保请求带 x-tdai-service-id,standalone 模式下确保 yaml 有 instanceId",
);
}
const useSystemUserKey = llm.proxy?.useMemorySystemUserKey ?? true;
let effectiveApiKey = llm.apiKey;
if (useSystemUserKey) {
if (!memorySystemUser) {
throw new LlmResolveError(
"llm.provider=proxy 且 llm.proxy.useMemorySystemUserKey=true 需要 " +
"metadata.systemUser.memory 完整配置(userId + userKey),当前缺失",
);
}
if (!isValidMemorySystemUserKey(memorySystemUser.userKey)) {
throw new LlmResolveError(
"metadata.systemUser.memory.userKey 必须匹配 sk-mem-[A-Za-z0-9_-]{32}",
);
}
effectiveApiKey = memorySystemUser.userKey;
}
if (!effectiveApiKey) {
throw new LlmResolveError(
"llm.provider=proxy 且 useMemorySystemUserKey=false 时必须显式配置 llm.apiKey",
);
}
View on GitHub (pinned to 3efcd317b8)
Solutions
- Fill metadata.systemUser.memory with both userId and userKey (userKey must match sk-mem-[A-Za-z0-9_-]{32}).
- Generate a memory system user key if none exists and put it in the metadata config.
- If you want to use a direct key instead, explicitly set llm.proxy.useMemorySystemUserKey: false and provide llm.apiKey.
Example fix
// before
metadata:
systemUser: {}
// after
metadata:
systemUser:
memory:
userId: mem-system
userKey: sk-mem-AbCdEf0123456789AbCdEf0123456789 Defensive patterns
Strategy: validation
Validate before calling
const useSysKey = llm.proxy?.useMemorySystemUserKey ?? true;
if (llm.provider === 'proxy' && useSysKey) {
const m = metadata?.systemUser?.memory;
if (!m?.userId || !m?.userKey) {
throw new Error('metadata.systemUser.memory requires both userId and userKey when useMemorySystemUserKey=true');
}
} Type guard
function hasMemorySystemUser(m: unknown): m is { userId: string; userKey: string } {
const o = m as any;
return !!o && typeof o.userId === 'string' && o.userId.length > 0 && typeof o.userKey === 'string' && o.userKey.length > 0;
} Try / catch
try {
gateway.start();
} catch (err) {
if (err instanceof LlmResolveError && err.message.includes('systemUser.memory')) {
console.error('Configure metadata.systemUser.memory (userId + userKey) or set useMemorySystemUserKey=false with llm.apiKey');
}
throw err;
} Prevention
- Provision the memory system user as a standard deployment step
- Treat useMemorySystemUserKey as defaulting to true — set it explicitly to avoid surprises
- Fill BOTH userId and userKey, never only one
- Validate the metadata section in CI config checks
When it happens
Trigger: provider=proxy (or omitted useMemorySystemUserKey, which defaults true) with metadata.systemUser.memory missing, or present with only userId or only userKey.
Common situations: Fresh deployment where the systemUser block was never populated; partially filled yaml (userKey left as placeholder/empty); operator set useMemorySystemUserKey implicitly true assuming llm.apiKey would be used; config refactor removed metadata.systemUser.
Related errors
- llm.provider=proxy 且 useMemorySystemUserKey=false 时必须显式配置 ll
- llm.provider=proxy 且 useMemorySystemUserKey=true 需要 metadata
- llm.provider=proxy 需要 llm.baseUrl 指向 context_proxy 根 URL (如
- llm.provider=proxy 需要 instanceId,但 core 当前 instanceId 为空 ——
- llm.provider=proxy 需要 llm.baseUrl 指向 context_proxy 根 URL
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/0807a848ed974b6c.
Report an issue: GitHub.