{"record":{"id":"0524d277bbfefed8","repo":"n8n-io/n8n","slug":"404-0524d2","errorCode":"404","errorMessage":"Credential to be updated not found. You can only update credentials owned by you","messagePattern":"Credential to be updated not found\\. You can only update credentials owned by you","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"packages/cli/src/credentials/credentials.controller.ts","lineNumber":255,"sourceCode":"\t\tconst {\n\t\t\tbody,\n\t\t\tuser,\n\t\t\tparams: { credentialId },\n\t\t} = req;\n\n\t\tconst credential = await this.credentialsFinderService.findCredentialForUser(\n\t\t\tcredentialId,\n\t\t\tuser,\n\t\t\t['credential:update'],\n\t\t\t{ includeInstanceCredentials: true },\n\t\t);\n\n\t\tif (!credential) {\n\t\t\tthis.logger.info('Attempt to update credential blocked due to lack of permissions', {\n\t\t\t\tcredentialId,\n\t\t\t\tuserId: user.id,\n\t\t\t});\n\t\t\tthrow new NotFoundError(\n\t\t\t\t'Credential to be updated not found. You can only update credentials owned by you',\n\t\t\t);\n\t\t}\n\n\t\tif (credential.isManaged) {\n\t\t\tthrow new BadRequestError('Managed credentials cannot be updated');\n\t\t}\n\n\t\tconst isChangingAuthType = body.type !== undefined && body.type !== credential.type;\n\n\t\tif (credential.usageScope === 'instance' && isChangingAuthType) {\n\t\t\tthrow new BadRequestError(\n\t\t\t\t'Provider connection type cannot be changed. Create a new connection instead.',\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tcredential.usageScope === 'instance' &&","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/cli/src/credentials/credentials.controller.ts#L237-L273","documentation":"Thrown inside the credential-update path when credentialsFinderService.findCredentialForUser(id,user,['credential:update'],{includeInstanceCredentials:true}) returns null — meaning no matching credential is visible to the user with the credential:update scope. HTTP 404. Like other credential errors, the message intentionally blends 'missing' and 'no-permission'. A logger.info records 'Attempt to update credential blocked due to lack of permissions' with the credentialId and userId.","triggerScenarios":"PUT/PATCH /credentials/:id where :id does not exist OR exists but the user lacks credential:update on the owning project; also when includeInstanceCredentials:true still yields no row.","commonSituations":"User was removed from a project but still has the credential open in an editor tab; cross-tenant id; credential deleted; RBAC scope missing after migration.","solutions":["Confirm via GET /credentials that the id is visible and that the user holds credential:update.","Refresh access by being re-added to the owning project, or use a credential you own.","Treat 404 here as terminal — do not retry without re-establishing access."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async function canUpdateCredential(credentialId: string) {\n  const r = await fetch(`/rest/credentials/${credentialId}`, { method: 'GET' });\n  if (!r.ok) return false;\n  const c = await r.json();\n  return c.scopes?.includes('credential:update') ?? false;\n}\nif (!(await canUpdateCredential(id))) {\n  throw new Error('No credential:update on this credential');\n}","typeGuard":"const canUpdate = (c: { scopes?: string[] }) =>\n  Array.isArray(c.scopes) && c.scopes.includes('credential:update');","tryCatchPattern":"try { await fetch(`/rest/credentials/${id}`, { method: 'PUT', body }); }\ncatch (e) { if (e.statusCode === 404) { /* refresh or regain access */ } else throw e; }","preventionTips":["Confirm credential:update scope on the owning project before editing.","Refresh the editor if the user's project membership changed.","Treat 404 here as terminal."],"tags":["credentials","update","rbac","rest-api","not-found","authorization"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}