{"record":{"id":"effa43e2f53cb501","repo":"paperclipai/paperclip","slug":"projectid-or-rootissueid-is-required-effa43","errorCode":null,"errorMessage":"projectId or rootIssueId is required","messagePattern":"projectId or rootIssueId is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/plugin-llm-wiki/src/worker.ts","lineNumber":641,"sourceCode":"      });\n      return { status: \"queued\", workItem, operation };\n    });\n\n    ctx.actions.register(\"enable-paperclip-distillation-active-projects\", async (params) => {\n      return enableActiveProjectDistillation(ctx, {\n        companyId: readCompanyIdFromParams(params),\n        wikiId: stringField(params.wikiId),\n        spaceSlug: stringField(params.spaceSlug),\n        limit: typeof params.limit === \"number\" ? params.limit : null,\n      });\n    });\n\n    ctx.actions.register(\"backfill-paperclip-distillation\", async (params) => {\n      const companyId = readCompanyIdFromParams(params);\n      const spaceSlug = stringField(params.spaceSlug);\n      const projectId = stringField(params.projectId);\n      const rootIssueId = stringField(params.rootIssueId);\n      if (!projectId && !rootIssueId) throw new Error(\"projectId or rootIssueId is required\");\n      const backfillStartAt = stringField(params.backfillStartAt);\n      const backfillEndAt = stringField(params.backfillEndAt);\n      const idempotencyScope = rootIssueId ? `root:${rootIssueId}` : `project:${projectId}`;\n      const workItem = await createPaperclipDistillationWorkItem(ctx, {\n        companyId,\n        wikiId: stringField(params.wikiId),\n        spaceSlug,\n        kind: \"backfill\",\n        projectId,\n        rootIssueId,\n        requestedByIssueId: stringField(params.requestedByIssueId),\n        priority: \"low\",\n        idempotencyKey: stringField(params.idempotencyKey) ?? `backfill:${idempotencyScope}:${backfillStartAt ?? \"begin\"}:${backfillEndAt ?? \"now\"}`,\n        metadata: { backfillStartAt, backfillEndAt, requestedFrom: \"backfill-paperclip-distillation\" },\n      });\n      const operation = await createOperationIssue(ctx, {\n        companyId,\n        wikiId: stringField(params.wikiId),","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/plugin-llm-wiki/src/worker.ts#L623-L659","documentation":"Thrown by the backfill-paperclip-distillation worker action when neither params.projectId nor params.rootIssueId is provided. This is the action-layer mirror of error 501; backfill must be scoped. The guard fires before createPaperclipDistillationWorkItem is called.","triggerScenarios":"Invoking the backfill-paperclip-distillation action with projectId and rootIssueId both null/blank.","commonSituations":"Operator requests a company-wide backfill; script enumerates companies but not projects; projectId was passed as 'project_id'.","solutions":["Pass projectId or rootIssueId on the backfill action.","For company-wide coverage, loop over projects and call the action once per projectId.","Use camelCase param names (projectId, rootIssueId)."],"exampleFix":"// before\nctx.actions.run('backfill-paperclip-distillation', { companyId });\n// after\nctx.actions.run('backfill-paperclip-distillation', { companyId, projectId });","handlingStrategy":"validation","validationCode":"function assertBackfillScope(params: { projectId?: string | null; rootIssueId?: string | null }) {\n  if (!params.projectId && !params.rootIssueId) throw new Error('projectId or rootIssueId is required');\n}","typeGuard":"function hasBackfillScope(p: unknown): p is { projectId: string } | { rootIssueId: string } {\n  return !!p && typeof p === 'object' && (!!(p as any).projectId || !!(p as any).rootIssueId);\n}","tryCatchPattern":"try { await worker.actions['backfill-paperclip-distillation'](params); } catch (err) { if (/projectId or rootIssueId is required/.test(String(err))) { /* loop projects */ } else throw err; }","preventionTips":["Loop over projects for company-wide backfill.","Use camelCase param keys (projectId, rootIssueId)."],"tags":["paperclip","distillation","backfill","validation"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}