paperclipai/paperclip · error

agentId is required

Error message

agentId is required

What it means

Thrown by the select-managed-agent worker action when params.agentId is missing or blank. The action binds a Wiki Maintainer agent to the company's managed resources; without an agentId there is nothing to select.

Source

Thrown at packages/plugins/plugin-llm-wiki/src/worker.ts:775

    ctx.actions.register("reconcile-managed-agent", async (params) => {
      return reconcileWikiAgentResource(ctx, readCompanyIdFromParams(params));
    });

    ctx.actions.register("reconcile-managed-project", async (params) => {
      return reconcileWikiProjectResource(ctx, readCompanyIdFromParams(params));
    });

    ctx.actions.register("reconcile-managed-skills", async (params) => {
      return { managedSkills: await reconcileWikiSkillResources(ctx, readCompanyIdFromParams(params)) };
    });

    ctx.actions.register("reset-managed-skills", async (params) => {
      return { managedSkills: await resetWikiSkillResources(ctx, readCompanyIdFromParams(params)) };
    });

    ctx.actions.register("select-managed-agent", async (params) => {
      const agentId = stringField(params.agentId);
      if (!agentId) throw new Error("agentId is required");
      return selectWikiAgentResource(ctx, {
        companyId: readCompanyIdFromParams(params),
        agentId,
      });
    });

    ctx.actions.register("select-managed-project", async (params) => {
      const projectId = stringField(params.projectId);
      if (!projectId) throw new Error("projectId is required");
      return selectWikiProjectResource(ctx, {
        companyId: readCompanyIdFromParams(params),
        projectId,
      });
    });

    ctx.actions.register("reset-managed-routine", async (params) => {
      return ctx.routines.managed.reset(
        routineKeyField(params.routineKey),

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Pass a valid agentId that exists for the company.
  2. Verify the agent via ctx.agents.get before calling to avoid the downstream 'could not be loaded' error.
  3. Use camelCase param name (agentId).

Example fix

// before
ctx.actions.run('select-managed-agent', { companyId });
// after
ctx.actions.run('select-managed-agent', { companyId, agentId });
Defensive patterns

Strategy: validation

Validate before calling

function assertAgentId(value: unknown) {
  if (typeof value !== 'string' || !value.trim()) throw new Error('agentId is required');
}

Type guard

function isNonBlankString(value: unknown): value is string {
  return typeof value === 'string' && value.trim().length > 0;
}

Prevention

When it happens

Trigger: Calling select-managed-agent without agentId, with an empty string, or with a whitespace value (stringField returns null).

Common situations: Operator forgot to pass the agent id; param keyed 'agent_id'; agent picker UI submitted before selection.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/55eca9685b2c3e35. Report an issue: GitHub.