paperclipai/paperclip · error · Error

priority must be critical, high, medium, or low

Error message

priority must be critical, high, medium, or low

What it means

Thrown by the create-paperclip-distillation-work-item worker action when params.priority is present and non-blank but not one of critical|high|medium|low. priority is optional (null allowed), but if supplied it must be a valid queue priority.

Source

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

        operationIssueId: operation.issue.id,
      });
      return { ...result, workItem, operation };
    });

    ctx.actions.register("create-paperclip-distillation-work-item", async (params) => {
      const kind = stringField(params.kind);
      if (
        kind !== "manual" &&
        kind !== "retry" &&
        kind !== "backfill" &&
        kind !== "priority_override" &&
        kind !== "review_patch"
      ) {
        throw new Error("kind must be manual, retry, backfill, priority_override, or review_patch");
      }
      const priority = stringField(params.priority);
      if (priority && priority !== "critical" && priority !== "high" && priority !== "medium" && priority !== "low") {
        throw new Error("priority must be critical, high, medium, or low");
      }
      return createPaperclipDistillationWorkItem(ctx, {
        companyId: readCompanyIdFromParams(params),
        wikiId: stringField(params.wikiId),
        spaceSlug: stringField(params.spaceSlug),
        kind,
        projectId: stringField(params.projectId),
        rootIssueId: stringField(params.rootIssueId),
        requestedByIssueId: stringField(params.requestedByIssueId),
        priority: priority as "critical" | "high" | "medium" | "low" | null,
        idempotencyKey: stringField(params.idempotencyKey),
        metadata: typeof params.metadata === "object" && params.metadata != null ? params.metadata as Record<string, unknown> : null,
      });
    });

    ctx.actions.register("file-as-page", async (params) => {
      return fileQueryAnswerAsPage(ctx, {
        companyId: readCompanyIdFromParams(params),

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Use one of: critical, high, medium, low (lowercase).
  2. Omit priority entirely to accept the default (the action passes null when absent).
  3. Map external priorities to the four valid labels before calling.

Example fix

// before
ctx.actions.run('create-paperclip-distillation-work-item', { companyId, kind: 'manual', priority: 'urgent' });
// after
ctx.actions.run('create-paperclip-distillation-work-item', { companyId, kind: 'manual', priority: 'high' });
Defensive patterns

Strategy: type-guard

Validate before calling

const PRIORITIES = ['critical','high','medium','low'] as const;
function assertPriority(value: string | null | undefined) {
  if (value != null && value !== '' && !(PRIORITIES as readonly string[]).includes(value)) {
    throw new Error(`priority must be one of ${PRIORITIES.join(', ')}`);
  }
}

Type guard

const PRIORITIES = ['critical','high','medium','low'] as const;
type WorkItemPriority = typeof PRIORITIES[number];
function isPriority(value: unknown): value is WorkItemPriority {
  return typeof value === 'string' && (PRIORITIES as readonly string[]).includes(value);
}

Prevention

When it happens

Trigger: Passing priority as a number, an unknown label ('urgent', 'normal', '1'), or a mis-cased value ('High').

Common situations: Caller forwards a priority from an external system whose scale differs; numeric priority passed instead of label; case mismatch.

Related errors


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