{"record":{"id":"0889bb4ea59d83f1","repo":"paperclipai/paperclip","slug":"backfill-work-items-must-target-a-projectid-or-roo","errorCode":null,"errorMessage":"Backfill work items must target a projectId or rootIssueId; whole-company backfill is not allowed.","messagePattern":"Backfill work items must target a projectId or rootIssueId; whole-company backfill is not allowed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/plugin-llm-wiki/src/wiki/core.ts","lineNumber":2902,"sourceCode":"          AND id = $6`,\n      [input.companyId, wikiId, input.runId, input.sourceWindowEnd, input.sourceHash, input.cursorId, space.id],\n    );\n  }\n\n  return {\n    status: input.status,\n    cursorAdvanced: input.status === \"succeeded\" && Boolean(input.cursorId && input.sourceHash && input.sourceWindowEnd),\n  };\n}\n\nexport async function createPaperclipDistillationWorkItem(ctx: PluginContext, input: PaperclipDistillationWorkItemInput) {\n  const wikiId = normalizeWikiId(input.wikiId);\n  assertPaperclipSourceScopePayload(input);\n  const space = await requirePaperclipIngestionPolicy(ctx, { companyId: input.companyId, wikiId, spaceSlug: input.spaceSlug }, \"queue\", { requireEnabledProfile: true });\n  const itemId = randomUUID();\n  const scope = paperclipCursorScopeMetadata(input);\n  if (input.kind === \"backfill\" && !scope.projectId && !scope.rootIssueId) {\n    throw new Error(\"Backfill work items must target a projectId or rootIssueId; whole-company backfill is not allowed.\");\n  }\n  await ctx.db.execute(\n    `INSERT INTO ${distillationWorkItemTable(ctx)} AS paperclip_distillation_work_items\n       (id, company_id, wiki_id, space_id, work_item_kind, status, priority, project_id, root_issue_id, requested_by_issue_id, idempotency_key, metadata)\n     VALUES ($1, $2, $3, $11, $4, 'pending', $5, $6, $7, $8, $9, $10::jsonb)\n     ON CONFLICT (company_id, wiki_id, space_id, idempotency_key)\n     DO UPDATE SET priority = EXCLUDED.priority,\n                   metadata = paperclip_distillation_work_items.metadata || EXCLUDED.metadata,\n                   updated_at = now()`,\n    [\n      itemId,\n      input.companyId,\n      wikiId,\n      input.kind,\n      input.priority ?? \"medium\",\n      scope.projectId,\n      scope.rootIssueId,\n      input.requestedByIssueId ?? null,","sourceCodeStart":2884,"sourceCodeEnd":2920,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/packages/plugins/plugin-llm-wiki/src/wiki/core.ts#L2884-L2920","documentation":"Error \"Backfill work items must target a projectId or rootIssueId; whole-company backfill is not allowed.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at packages/plugins/plugin-llm-wiki/src/wiki/core.ts:2904 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set projectId or rootIssueId on the backfill work item; company-wide backfill is not supported."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5716fe907e596ce73501408fc6efdb19fb61edf2","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}