paperclipai/paperclip · error · Error

Unknown managed routine: ${routineKey}

Error message

Unknown managed routine: ${routineKey}

What it means

Thrown by routineKeyField when routineKey is present and non-blank but not in WIKI_MAINTENANCE_ROUTINE_KEYS (['cursor-window-processing','nightly-wiki-lint','index-refresh']). The set is fixed by the plugin manifest; arbitrary routine keys are rejected.

Source

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

  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 = [
  "issue.created",
  "issue.updated",
  "issue.comment.created",

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Use one of the exact keys: 'cursor-window-processing', 'nightly-wiki-lint', 'index-refresh'.
  2. List available routines via the plugin manifest or reconcile-managed-routines before calling.
  3. If you believe the key should exist, check manifest.ts WIKI_MAINTENANCE_ROUTINE_KEYS for the current spelling.

Example fix

// before
routineKeyField({ routineKey: 'lint' });
// after
routineKeyField({ routineKey: 'nightly-wiki-lint' });
Defensive patterns

Strategy: type-guard

Validate before calling

const ALLOWED = ['cursor-window-processing', 'nightly-wiki-lint', 'index-refresh'];
function assertKnownRoutineKey(value: string) {
  if (!ALLOWED.includes(value)) 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: Passing a routineKey like 'wiki-maint', 'lint', 'distill', or any value outside the three allowed keys to a managed-routine worker action.

Common situations: Caller guesses the key from a routine title instead of its key; version drift where a key was renamed but the caller still uses the old one; typo in the key.

Related errors


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