{"record":{"id":"190a891e8967feb2","repo":"paperclipai/paperclip","slug":"llm-wiki-plugin-has-not-been-set-up","errorCode":null,"errorMessage":"LLM Wiki plugin has not been set up","messagePattern":"LLM Wiki plugin has not been set up","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/plugins/plugin-llm-wiki/src/worker.ts","lineNumber":108,"sourceCode":"  \"issue.created\",\n  \"issue.updated\",\n  \"issue.comment.created\",\n  \"issue.document.created\",\n  \"issue.document.updated\",\n] as const;\n\ntype ManagedRoutineDefaultDrift = {\n  changedFields: string[];\n  defaultTitle: string;\n  defaultDescription: string | null;\n};\n\ntype ManagedRoutineSettingsResolution = PluginManagedRoutineResolution & {\n  defaultDrift: ManagedRoutineDefaultDrift | null;\n};\n\nfunction requireContext(): PluginContext {\n  if (!activeContext) throw new Error(\"LLM Wiki plugin has not been set up\");\n  return activeContext;\n}\n\nfunction normalizeRoutineTemplateText(value: unknown): string | null {\n  if (typeof value !== \"string\") return null;\n  const normalized = value.replace(/\\r\\n/g, \"\\n\").trim();\n  return normalized.length > 0 ? normalized : null;\n}\n\nfunction manualDistillScopeLabel(input: { projectId?: string | null; rootIssueId?: string | null }) {\n  if (input.rootIssueId) return \"selected root issue\";\n  if (input.projectId) return \"selected project\";\n  return \"company-wide stale cursor scan\";\n}\n\nfunction buildManualDistillPrompt(input: { companyId: string; projectId?: string | null; rootIssueId?: string | null }) {\n  const scopeLabel = manualDistillScopeLabel(input);\n  return [","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/plugin-llm-wiki/src/worker.ts#L90-L126","documentation":"Thrown by requireContext() in worker.ts when activeContext is null/undefined, i.e. the worker entry point is being used before the plugin's setup hook ran (or after teardown). All worker actions depend on a PluginContext; without it, none of the DB/agent/localFolder surfaces are available.","triggerScenarios":"Calling any worker.ts function that calls requireContext() before the plugin manifest setup() assigned activeContext, or importing worker.ts helpers in a context where the plugin was never registered.","commonSituations":"Unit test imports worker.ts directly without simulating setup; a race where an action fires during plugin teardown; the plugin failed to install and actions are still routed to it.","solutions":["Ensure the plugin's setup hook completed before dispatching actions (await plugin registration in the host).","In tests, drive the plugin through its public setup entrypoint rather than calling worker helpers directly.","Confirm the plugin is enabled for the company/workspace in question."],"exampleFix":"// before: worker helper called with no setup -> 'has not been set up'\n// after: await plugin.setup(hostContext); worker.doWork();","handlingStrategy":"validation","validationCode":"function assertPluginReady() {\n  if (!activeContext) throw new Error('Plugin not initialised: await plugin.setup() first');\n}","typeGuard":null,"tryCatchPattern":"if (!pluginReady) { await plugin.setup(host); }\ntry { worker.doWork(); } catch (err) { if (/has not been set up/.test(String(err))) { await plugin.setup(host); worker.doWork(); } else throw err; }","preventionTips":["Drive the plugin via its setup entrypoint; do not import worker helpers directly.","Await plugin registration before dispatching actions.","In tests, simulate setup to populate activeContext."],"tags":["paperclip","wiki","lifecycle","initialization"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}