{"record":{"id":"af80a070377fb64a","repo":"paperclipai/paperclip","slug":"entityname-not-found","errorCode":null,"errorMessage":"${entityName} not found","messagePattern":"(.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/plugin-host-services.ts","lineNumber":865,"sourceCode":"    companyId: workspace.companyId,\n    projectId: workspace.projectId,\n    projectWorkspaceId: workspace.projectWorkspaceId,\n    path: workspace.cwd ?? workspace.providerRef,\n    cwd: workspace.cwd,\n    repoUrl: workspace.repoUrl,\n    baseRef: workspace.baseRef,\n    branchName: workspace.branchName,\n    providerType: workspace.providerType,\n    providerMetadata: readProviderMetadata(workspace.metadata),\n  });\n\n  const requireInCompany = <T extends { companyId: string | null | undefined }>(\n    entityName: string,\n    record: T | null | undefined,\n    companyId: string,\n  ): T => {\n    if (!inCompany(record, companyId)) {\n      throw new Error(`${entityName} not found`);\n    }\n    return record;\n  };\n\n  /**\n   * Verify `userId` is an active human member of `companyId` before letting a\n   * plugin attribute a mutation to them. Mirrors the authorization bar the\n   * web app's own board routes apply — a plugin can only ever attribute an\n   * action to an identity that could have taken it in the web app itself.\n   * Used by any plugin capability that accepts an `actorUserId`\n   * (`createComment`'s human-attributed path, `respondInteraction`, and\n   * `approvals.decide`).\n   *\n   * All current call sites are non-safe (write) actions, so by default this\n   * also rejects a `viewer`-role member — the web app's board write-routes\n   * treat `membershipRole === \"viewer\"` as read-only and 403 it (\"Viewer\n   * access is read-only\", routes/authz.ts:115-116). Without this bar a plugin\n   * holding `approvals.respond` / `issue.interactions.respond` could attribute","sourceCodeStart":847,"sourceCodeEnd":883,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/services/plugin-host-services.ts#L847-L883","documentation":"requireInCompany received a null/undefined record (or one whose companyId does not match) for the named entity. It is the generic company-boundary lookup guard: the requested entity does not exist or is not accessible within the calling company.","triggerScenarios":"Thrown at server/src/services/plugin-host-services.ts:856 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the named entity exists for the company; create it first or correct the identifier."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}