{"record":{"id":"c3db7db00abc9535","repo":"paperclipai/paperclip","slug":"policy-resource-not-found","errorCode":null,"errorMessage":"Policy resource not found","messagePattern":"Policy resource not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/plugin-host-services.ts","lineNumber":3152,"sourceCode":"          else delete executionPolicy.authorizationPolicy;\n          await db\n            .update(issuesTable)\n            .set({ executionPolicy, updatedAt: new Date() })\n            .where(eq(issuesTable.id, issue.id));\n        } else {\n          const company = await companies.getById(params.resourceId);\n          if (!company || company.id !== companyId) throw new Error(\"Company not found\");\n          throw new Error(\"Company authorization policy updates are not supported by the current core schema\");\n        }\n        await logPluginActivity({\n          companyId,\n          action: \"authorization.policy_updated_by_plugin\",\n          entityType: params.resourceType,\n          entityId: params.resourceId,\n          details: { hasPolicy: Boolean(policy) },\n        });\n        const updated = await readAuthorizationPolicy(companyId, params.resourceType, params.resourceId);\n        if (!updated) throw new Error(\"Policy resource not found\");\n        return updated;\n      },\n      async previewAssignment(params) {\n        const companyId = ensureCompanyId(params.companyId);\n        await ensurePluginAvailableForCompany(companyId);\n        return authorization.decide({\n          actor: pluginAssignmentActor(params.actor),\n          action: \"tasks:assign\",\n          resource: { type: \"issue\", companyId, ...params.target },\n          scope: {\n            issueId: params.target.issueId ?? null,\n            projectId: params.target.projectId ?? null,\n            parentIssueId: params.target.parentIssueId ?? null,\n            assigneeAgentId: params.target.assigneeAgentId ?? null,\n            assigneeUserId: params.target.assigneeUserId ?? null,\n          },\n        });\n      },","sourceCodeStart":3134,"sourceCodeEnd":3170,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/services/plugin-host-services.ts#L3134-L3170","documentation":"The authorization policy update targeted neither project nor issue and the fallback company branch also failed, meaning the resourceId did not resolve to a policy-bearing resource in this company. Generic 'resource does not exist' guard for the policy API.","triggerScenarios":"Thrown at server/src/services/plugin-host-services.ts:3143 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the policy resource identifier exists; list policy resources for the company and use a valid one."],"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"}