paperclipai/paperclip · error · Error

routineKey is required; valid values: ${WIKI_MAINTENANCE_ROU

Error message

routineKey is required; valid values: ${WIKI_MAINTENANCE_ROUTINE_KEYS.join(", ")}

What it means

Thrown by routineKeyField in worker.ts when the routineKey param is missing or blank after trimming. routineKeyField powers managed-routine actions (reset/update) and must resolve to one of the WIKI_MAINTENANCE_ROUTINE_KEYS. The empty-check precedes the membership check.

Source

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

  selectWikiAgentResource,
  selectWikiProjectResource,
  startWikiQuerySession,
  spaceFolderStatus,
  updateEventIngestionSettings,
  updatePaperclipIngestionProfile,
  updateSpace,
  writeTemplate,
  writeWikiPage,
} from "./wiki.js";

function stringField(value: unknown): string | null {
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
}

function routineKeyField(value: unknown): (typeof WIKI_MAINTENANCE_ROUTINE_KEYS)[number] {
  const routineKey = stringField(value);
  if (!routineKey) {
    throw new Error(`routineKey is required; valid values: ${WIKI_MAINTENANCE_ROUTINE_KEYS.join(", ")}`);
  }
  if (!WIKI_MAINTENANCE_ROUTINE_KEYS.includes(routineKey as (typeof WIKI_MAINTENANCE_ROUTINE_KEYS)[number])) {
    throw new Error(`Unknown managed routine: ${routineKey}`);
  }
  return routineKey as (typeof WIKI_MAINTENANCE_ROUTINE_KEYS)[number];
}

function routineOverridesFromParams(params: Record<string, unknown>) {
  const overrides: { assigneeAgentId?: string; projectId?: string } = {};
  const assigneeAgentId = stringField(params.assigneeAgentId);
  const projectId = stringField(params.projectId);
  if (assigneeAgentId) overrides.assigneeAgentId = assigneeAgentId;
  if (projectId) overrides.projectId = projectId;
  return overrides;
}

let activeContext: PluginContext | null = null;
const PAPERCLIP_EVENT_INGESTION_EVENTS = [

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Pass routineKey as one of: 'cursor-window-processing', 'nightly-wiki-lint', 'index-refresh'.
  2. Check the param name spelling (camelCase routineKey).
  3. Default the param at the caller if a specific routine is implied by context.

Example fix

// before
ctx.actions.run('reset-managed-routine', { companyId });
// after
ctx.actions.run('reset-managed-routine', { companyId, routineKey: 'nightly-wiki-lint' });
Defensive patterns

Strategy: validation

Validate before calling

const WIKI_MAINTENANCE_ROUTINE_KEYS = ['cursor-window-processing', 'nightly-wiki-lint', 'index-refresh'] as const;
function assertRoutineKey(value: unknown) {
  if (typeof value !== 'string' || !value.trim()) throw new Error('routineKey is required');
  if (!WIKI_MAINTENANCE_ROUTINE_KEYS.includes(value as any)) throw new Error(`Unknown managed routine: ${value}`);
}

Type guard

const WIKI_MAINTENANCE_ROUTINE_KEYS = ['cursor-window-processing', 'nightly-wiki-lint', 'index-refresh'] as const;
function isRoutineKey(value: unknown): value is typeof WIKI_MAINTENANCE_ROUTINE_KEYS[number] {
  return typeof value === 'string' && (WIKI_MAINTENANCE_ROUTINE_KEYS as readonly string[]).includes(value);
}

Prevention

When it happens

Trigger: Invoking a managed-routine worker action (e.g. reset-managed-routine) without routineKey, with an empty string, or with a whitespace-only value.

Common situations: Action caller forgot the param; param spelled 'routine_key' or 'routine' instead of 'routineKey'; a generic routine dispatcher forwarded params but dropped routineKey.

Related errors


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