TencentCloud/TencentDB-Agent-Memory · error

skill create failed: ${createEnv.code}

Error message

skill create failed: ${createEnv.code}

What it means

After fetching the source detail, forkSkillToAgent creates the new skill via a 'create' command in a forked environment. Non-zero codes abort the fork — except 42201, which is tolerated as an expected 'already exists' style response, so only genuinely failed creates throw.

Source

Thrown at MemoryPanel/src/panel/http/routes/meta/proxy.ts:403

          is_executable: entry.is_executable,
        });
      }
    } catch {
      /* 单个资源读取失败则跳过 */
    }
  }

  const createEnv = await deps.skillKernel.invoke('create', {
    user_id: userId,
    team_id: teamId,
    agent_id: targetAgentId,
    name: detail.name,
    content: detail.content,
    resources: resources.length ? resources : undefined,
    metadata: { forked_from: { skill_id: sourceSkillId, name: detail.name } },
  }, ctx);
  if (createEnv.code !== 0 && createEnv.code !== 42201) {
    throw new Error(`skill create failed: ${createEnv.code}`);
  }
}

/** 把 knowledge 资产(code_graph / wiki)引用绑定到 agent(list → append → set)。 */
async function allocateKnowledgeToAgent(
  deps: PanelDeps,
  ctx: MetaCallContext,
  agentId: string,
  assetId: string,
  assetType: string,
): Promise<void> {
  const caller = await resolveCallerUserId(deps, ctx);
  const listEnv = await deps.metaKernel.invoke('agent-fixed-asset/list', { agent_id: agentId }, ctx);
  if (listEnv.code !== 0) return;
  const bindings = extractListItems<{
    asset_id: string;
    asset_type: string;
    injection_mode?: string;

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Log createEnv.code with stderr to find the backend's rejection reason
  2. Rename the target skill (or pre-delete the existing one) if it's a duplicate-name issue
  3. Check team/user skill quota and free a slot before retrying
  4. If 42201-equivalent duplicates should be tolerated, extend the accepted code list after confirming semantics

Example fix

// before
if (createEnv.code !== 0 && createEnv.code !== 42201) {
  throw new Error(`skill create failed: ${createEnv.code}`);
}
// after
if (createEnv.code !== 0 && createEnv.code !== 42201) {
  throw new Error(`skill create failed: ${createEnv.code} (${createEnv.stderr ?? 'no detail'})`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const dup = await skillsApi.findByName({ name: detail.name, team_id: teamId });
if (dup) throw new Error(`skill name already taken: ${detail.name}`);

Try / catch

try { await forkSkillToAgent(...); } catch (e) { if (e.message.startsWith('skill create failed:')) { logger.error(`fork create rejected (${e.message}); check duplicate names, quota, permissions`); } else throw e; }

Prevention

When it happens

Trigger: Creating the forked skill when the backend rejects it: duplicate name not covered by 42201, quota exceeded, invalid manifest/resources payload, or permission failure for the target team.

Common situations: Forking twice with the same target name where backend returns a code other than 42201; team skill quota reached; oversized skill content rejected by the backend; name collisions with special characters.

Related errors


AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01). Data as JSON: /api/errors/d3010b462332715d. Report an issue: GitHub.