{"record":{"id":"21d8725d6c7e350d","repo":"paperclipai/paperclip","slug":"unknown-managed-routine-routinekey","errorCode":null,"errorMessage":"Unknown managed routine: ${routineKey}","messagePattern":"Unknown managed routine: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/plugin-llm-wiki/src/worker.ts","lineNumber":74,"sourceCode":"  spaceFolderStatus,\n  updateEventIngestionSettings,\n  updatePaperclipIngestionProfile,\n  updateSpace,\n  writeTemplate,\n  writeWikiPage,\n} from \"./wiki.js\";\n\nfunction stringField(value: unknown): string | null {\n  return typeof value === \"string\" && value.trim().length > 0 ? value.trim() : null;\n}\n\nfunction routineKeyField(value: unknown): (typeof WIKI_MAINTENANCE_ROUTINE_KEYS)[number] {\n  const routineKey = stringField(value);\n  if (!routineKey) {\n    throw new Error(`routineKey is required; valid values: ${WIKI_MAINTENANCE_ROUTINE_KEYS.join(\", \")}`);\n  }\n  if (!WIKI_MAINTENANCE_ROUTINE_KEYS.includes(routineKey as (typeof WIKI_MAINTENANCE_ROUTINE_KEYS)[number])) {\n    throw new Error(`Unknown managed routine: ${routineKey}`);\n  }\n  return routineKey as (typeof WIKI_MAINTENANCE_ROUTINE_KEYS)[number];\n}\n\nfunction routineOverridesFromParams(params: Record<string, unknown>) {\n  const overrides: { assigneeAgentId?: string; projectId?: string } = {};\n  const assigneeAgentId = stringField(params.assigneeAgentId);\n  const projectId = stringField(params.projectId);\n  if (assigneeAgentId) overrides.assigneeAgentId = assigneeAgentId;\n  if (projectId) overrides.projectId = projectId;\n  return overrides;\n}\n\nlet activeContext: PluginContext | null = null;\nconst PAPERCLIP_EVENT_INGESTION_EVENTS = [\n  \"issue.created\",\n  \"issue.updated\",\n  \"issue.comment.created\",","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/plugin-llm-wiki/src/worker.ts#L56-L92","documentation":"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.","triggerScenarios":"Passing a routineKey like 'wiki-maint', 'lint', 'distill', or any value outside the three allowed keys to a managed-routine worker action.","commonSituations":"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.","solutions":["Use one of the exact keys: 'cursor-window-processing', 'nightly-wiki-lint', 'index-refresh'.","List available routines via the plugin manifest or reconcile-managed-routines before calling.","If you believe the key should exist, check manifest.ts WIKI_MAINTENANCE_ROUTINE_KEYS for the current spelling."],"exampleFix":"// before\nroutineKeyField({ routineKey: 'lint' });\n// after\nroutineKeyField({ routineKey: 'nightly-wiki-lint' });","handlingStrategy":"type-guard","validationCode":"const ALLOWED = ['cursor-window-processing', 'nightly-wiki-lint', 'index-refresh'];\nfunction assertKnownRoutineKey(value: string) {\n  if (!ALLOWED.includes(value)) throw new Error(`Unknown managed routine: ${value}`);\n}","typeGuard":"const WIKI_MAINTENANCE_ROUTINE_KEYS = ['cursor-window-processing', 'nightly-wiki-lint', 'index-refresh'] as const;\nfunction isRoutineKey(value: unknown): value is typeof WIKI_MAINTENANCE_ROUTINE_KEYS[number] {\n  return typeof value === 'string' && (WIKI_MAINTENANCE_ROUTINE_KEYS as readonly string[]).includes(value);\n}","tryCatchPattern":null,"preventionTips":["Source routine keys from the manifest constants, not hardcoded strings.","List available routines before letting operators pick one."],"tags":["paperclip","wiki","routine","validation"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}