TencentCloud/TencentDB-Agent-Memory · error
agent-fixed-asset/set failed: ${setEnv.code}
Error message
agent-fixed-asset/set failed: ${setEnv.code} What it means
allocateKnowledgeToAgent calls the meta-kernel operation 'agent-fixed-asset/set' and expects a response envelope. A non-zero `code` on the envelope means the kernel rejected the agent asset-binding update (e.g. unknown agent_id, invalid bindings, or an internal kernel failure). The throw surfaces only the numeric code, not the kernel's human-readable message, which makes diagnosis from the caller side harder.
Source
Thrown at MemoryPanel/src/panel/http/routes/meta/proxy.ts:439
injection_mode?: string;
priority?: number;
created_by?: string;
}>(listEnv);
if (bindings.some((b) => b.asset_id === assetId)) return; // 已绑定,幂等跳过
const newBindings = [
...bindings.map((b) => ({
asset_id: b.asset_id,
asset_type: b.asset_type,
injection_mode: b.injection_mode ?? 'summary',
priority: b.priority ?? 50,
created_by: b.created_by,
})),
{ asset_id: assetId, asset_type: assetType, injection_mode: 'tool', priority: 50, created_by: caller },
];
const setEnv = await deps.metaKernel.invoke('agent-fixed-asset/set', { agent_id: agentId, bindings: newBindings }, ctx);
if (setEnv.code !== 0) {
throw new Error(`agent-fixed-asset/set failed: ${setEnv.code}`);
}
}
// ── team-member/add 成功后:为 default-agent 导入预置 Skill ──
async function importDefaultSkillsForNewMember(
body: Record<string, unknown>,
ctx: MetaCallContext,
deps: PanelDeps,
): Promise<void> {
try {
const userId = body.user_id as string | undefined;
const teamId = body.team_id as string | undefined;
if (!userId || !teamId) return;
// 1. 获取用户信息(拿 username 拼 agent 名称)
const userEnv = await deps.metaKernel.invoke('user/get', { user_id: userId }, ctx);
if (userEnv.code !== 0) return;View on GitHub (pinned to 3efcd317b8)
Solutions
- Log the full setEnv envelope (message/data) instead of only code, then fix the root cause reported by the kernel
- Verify the agent_id exists before invoking 'agent-fixed-asset/set' (fetch the agent or list agents first)
- Validate each binding (asset_id exists, asset_type/injection_mode values accepted by the current kernel version)
- Retry the clone operation if the kernel returned a transient error code; check kernel health if failures persist
Example fix
// before
const setEnv = await deps.metaKernel.invoke('agent-fixed-asset/set', { agent_id: agentId, bindings: newBindings }, ctx);
if (setEnv.code !== 0) {
throw new Error(`agent-fixed-asset/set failed: ${setEnv.code}`);
}
// after
const setEnv = await deps.metaKernel.invoke('agent-fixed-asset/set', { agent_id: agentId, bindings: newBindings }, ctx);
if (setEnv.code !== 0) {
throw new Error(`agent-fixed-asset/set failed: code=${setEnv.code} agent=${agentId} msg=${(setEnv as any).message ?? 'n/a'}`);
} Defensive patterns
Strategy: validation
Validate before calling
const agents = await deps.metaKernel.invoke('agent/list', {}, ctx);
if (agents.code !== 0 || !agents.data?.some(a => a.agent_id === agentId)) {
throw new Error(`agent ${agentId} not found before agent-fixed-asset/set`);
} Type guard
function isOkEnvelope(env: { code: number }): env is { code: 0 } {
return env.code === 0;
} Try / catch
try {
const setEnv = await deps.metaKernel.invoke('agent-fixed-asset/set', { agent_id: agentId, bindings: newBindings }, ctx);
if (!isOkEnvelope(setEnv)) throw new Error(`agent-fixed-asset/set failed: ${setEnv.code}`);
} catch (e) {
logger.error({ agentId, bindingCount: newBindings.length, err: e });
throw e;
} Prevention
- Always verify the target agent exists before mutating its assets
- Log the full kernel envelope (code + message + data), never just the code
- Validate asset_ids referenced by templates exist in the kernel before cloning
- Treat kernel non-zero codes as retriable vs fatal via an explicit code table
When it happens
Trigger: Calling cloneTemplateAssets (which calls allocateKnowledgeToAgent) when: the target agent_id does not exist in the kernel; the bindings payload fails kernel-side validation (e.g. asset_id not found, bad asset_type); the meta-kernel is degraded and returns an internal error code; or the caller lacks permission to mutate the agent's fixed assets.
Common situations: Cloning a team template right after team-member/add when the default agent has not finished provisioning; kernel schema/version drift where 'injection_mode' or 'priority' fields are rejected; transient kernel store failures during asset import.
Related errors
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/9aa959cfdcf6f432.
Report an issue: GitHub.