n8n-io/n8n · error · NotFoundError
404
404
Error message
Credential not found
What it means
Thrown by EnterpriseCredentialsService.shareWithProjects when em.exists(CredentialsEntity, { id: credentialId, usageScope: 'project' }) is false. The credential either does not exist at all or is an instance (provider) credential (usageScope !== 'project'), which cannot be shared with projects via this path.
Source
Thrown at packages/cli/src/credentials/credentials.service.ee.ts:53
private readonly credentialsFinderService: CredentialsFinderService,
private readonly roleService: RoleService,
private readonly externalSecretsConfig: ExternalSecretsConfig,
private readonly externalSecretsProviderAccessCheckService: SecretsProviderAccessCheckService,
private readonly licenseState: LicenseState,
private readonly connectionStatusProxy: CredentialConnectionStatusProxy,
) {}
async shareWithProjects(
user: User,
credentialId: string,
shareWithIds: string[],
entityManager?: EntityManager,
) {
const em = entityManager ?? this.sharedCredentialsRepository.manager;
const canShare = await em.exists(CredentialsEntity, {
where: { id: credentialId, usageScope: 'project' },
});
if (!canShare) throw new NotFoundError('Credential not found');
const roles = await this.roleService.rolesWithScope('project', ['project:list']);
let projects = await em.find(Project, {
where: [
{
id: In(shareWithIds),
type: 'team',
// if user can see all projects, don't check project access
// if they can't, find projects they can list
...(hasGlobalScope(user, 'project:list')
? {}
: {
projectRelations: {
userId: user.id,
role: In(roles),
},
}),View on GitHub (pinned to 5ac6606e81)
Solutions
- Confirm the credentialId exists and usageScope === 'project' before sharing.
- If the credential is an instance credential, use the instance-credential management path instead.
- Reload the credential list to discard stale IDs.
Defensive patterns
Strategy: validation
Validate before calling
const cred = await axios.get(`/credentials/${id}`).then(r => r.data).catch(() => null);
if (!cred || cred.usageScope !== 'project') {
throw new Error('Only project-scoped credentials can be shared with projects.');
}
await shareWithProjects(user, id, projectIds); Type guard
function isProjectCredential(c: { usageScope?: string }): boolean {
return c?.usageScope === 'project';
} Prevention
- Share only project-scoped credentials via shareWithProjects.
- Route instance/provider connections through instance-credential endpoints.
- Refresh the credential list if a 404 appears mid-share (deleted concurrently).
When it happens
Trigger: Calling shareWithProjects with a credentialId that is missing or whose usageScope is 'instance'. Typically reached transitively through PUT /credentials/:id/share when the credential was converted to an instance credential or deleted.
Common situations: Race between a share request and a delete/transfer. Attempting to share an instance/provider connection as if it were a project credential.
Related errors
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/2eb8769b2f678430.
Report an issue: GitHub.