paperclipai/paperclip · critical · Error

LLM Wiki plugin has not been set up

Error message

LLM Wiki plugin has not been set up

What it means

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.

Source

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

  "issue.created",
  "issue.updated",
  "issue.comment.created",
  "issue.document.created",
  "issue.document.updated",
] as const;

type ManagedRoutineDefaultDrift = {
  changedFields: string[];
  defaultTitle: string;
  defaultDescription: string | null;
};

type ManagedRoutineSettingsResolution = PluginManagedRoutineResolution & {
  defaultDrift: ManagedRoutineDefaultDrift | null;
};

function requireContext(): PluginContext {
  if (!activeContext) throw new Error("LLM Wiki plugin has not been set up");
  return activeContext;
}

function normalizeRoutineTemplateText(value: unknown): string | null {
  if (typeof value !== "string") return null;
  const normalized = value.replace(/\r\n/g, "\n").trim();
  return normalized.length > 0 ? normalized : null;
}

function manualDistillScopeLabel(input: { projectId?: string | null; rootIssueId?: string | null }) {
  if (input.rootIssueId) return "selected root issue";
  if (input.projectId) return "selected project";
  return "company-wide stale cursor scan";
}

function buildManualDistillPrompt(input: { companyId: string; projectId?: string | null; rootIssueId?: string | null }) {
  const scopeLabel = manualDistillScopeLabel(input);
  return [

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Ensure the plugin's setup hook completed before dispatching actions (await plugin registration in the host).
  2. In tests, drive the plugin through its public setup entrypoint rather than calling worker helpers directly.
  3. Confirm the plugin is enabled for the company/workspace in question.

Example fix

// before: worker helper called with no setup -> 'has not been set up'
// after: await plugin.setup(hostContext); worker.doWork();
Defensive patterns

Strategy: validation

Validate before calling

function assertPluginReady() {
  if (!activeContext) throw new Error('Plugin not initialised: await plugin.setup() first');
}

Try / catch

if (!pluginReady) { await plugin.setup(host); }
try { worker.doWork(); } catch (err) { if (/has not been set up/.test(String(err))) { await plugin.setup(host); worker.doWork(); } else throw err; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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