{"record":{"id":"672d9feeefa003b4","repo":"paperclipai/paperclip","slug":"paperclip-ingestion-profile-must-include-at-least","errorCode":null,"errorMessage":"Paperclip ingestion profile must include at least one source scope before it can be enabled.","messagePattern":"Paperclip ingestion profile must include at least one source scope before it can be enabled\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/plugin-llm-wiki/src/wiki/core.ts","lineNumber":992,"sourceCode":"    }\n  }\n  return overlaps;\n}\n\nasync function validatePaperclipIngestionProfile(ctx: PluginContext, input: {\n  companyId: string;\n  space: WikiSpace;\n  profile: PaperclipIngestionProfileV1;\n}) {\n  const policy = evaluatePaperclipProfilePolicy({\n    space: input.space,\n    profile: input.profile,\n    purpose: \"profile_update\",\n    requireEnabledProfile: input.profile.enabled && input.space.slug !== DEFAULT_SPACE_SLUG,\n  });\n  if (!policy.allowed) throw new Error(policy.message);\n  if (input.profile.enabled && input.profile.sourceScopes.length === 0) {\n    throw new Error(\"Paperclip ingestion profile must include at least one source scope before it can be enabled.\");\n  }\n  if (input.profile.sourceScopes.length > MAX_PAPERCLIP_INGESTION_PROFILE_SOURCE_COUNT) {\n    throw new Error(`Paperclip ingestion profile sources exceed the hard cap of ${MAX_PAPERCLIP_INGESTION_PROFILE_SOURCE_COUNT}.`);\n  }\n  for (const scope of input.profile.sourceScopes) {\n    if (scope.kind === \"company_all\" && input.space.slug !== DEFAULT_SPACE_SLUG) {\n      throw new Error(\"Everything in the company is only available on the default wiki space.\");\n    }\n    if (scope.kind === \"selected_projects\") {\n      if (scope.projectIds.length > MAX_PAPERCLIP_PROFILE_SELECTED_PROJECTS) {\n        throw new Error(`selected_projects exceeds the hard cap of ${MAX_PAPERCLIP_PROFILE_SELECTED_PROJECTS}.`);\n      }\n      for (const projectId of scope.projectIds) {\n        const project = await ctx.projects.get(projectId, input.companyId);\n        if (!project) throw new Error(`Project belongs to another company or does not exist: ${projectId}`);\n      }\n    }\n    if (scope.kind === \"root_issues\") {","sourceCodeStart":974,"sourceCodeEnd":1010,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/plugin-llm-wiki/src/wiki/core.ts#L974-L1010","documentation":"Thrown by validatePaperclipIngestionProfile() when the profile has enabled=true but sourceScopes is empty. An enabled profile must scope at least one Paperclip source; otherwise ingestion would have nothing to pull. This runs after the policy check, so the space itself is eligible. (Same code at line 992; error 477 is the duplicate occurrence.)","triggerScenarios":"Submitting a profile update with enabled: true and sourceScopes: []. Saving a partially-configured profile before adding any scope.","commonSituations":"UI lets the user flip Enable before adding scopes. API client that defaults sourceScopes to []. Migration that lost scope entries.","solutions":["Add at least one source scope (selected_projects, root_issues, or company_all on default space) before enabling.","If not ready to enable, set enabled: false until scopes are configured.","Validate in the UI that the Enable action is disabled while sourceScopes is empty."],"exampleFix":"// before\nprofile = { enabled: true, sourceScopes: [], ... };\n// after\nprofile = { enabled: true, sourceScopes: [{ kind: \"company_all\" }], ... }; // default space only\n// or:\nprofile = { enabled: false, sourceScopes: [], ... };","handlingStrategy":"validation","validationCode":"function assertEnabledHasScopes(profile: { enabled: boolean; sourceScopes: unknown[] }) {\n  if (profile.enabled && profile.sourceScopes.length === 0) {\n    throw new Error(\"Add at least one source scope before enabling the profile.\");\n  }\n}","typeGuard":"function canEnableProfile(profile: { sourceScopes: unknown[] }): boolean {\n  return profile.sourceScopes.length > 0;\n}","tryCatchPattern":"try {\n  await validatePaperclipIngestionProfile(ctx, { companyId, space, profile });\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"must include at least one source scope\")) {\n    profile.sourceScopes.push({ kind: \"selected_projects\", projectIds: [\"p1\"] }); // then retry\n  } else throw err;\n}","preventionTips":["Disable the Enable toggle in the UI until sourceScopes.length > 0.","Add scopes first, enable second.","Validate with a schema that requires sourceScopes:minItems when enabled=true."],"tags":["llm-wiki","profile","validation","paperclip"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}