{"record":{"id":"95de42660f216554","repo":"n8n-io/n8n","slug":"provider-connections-cannot-be-global-managed-or","errorCode":null,"errorMessage":"Provider connections cannot be global, managed, or dynamically resolved","messagePattern":"Provider connections cannot be global, managed, or dynamically resolved","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/import/credentials.ts","lineNumber":200,"sourceCode":"\t\t\t\t\tcredential.type !== existing.type\n\t\t\t\t) {\n\t\t\t\t\tthrow new UserError(\n\t\t\t\t\t\t'Provider connection type cannot be changed. Create a new connection instead.',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcredential.usageScope ??= 'project';\n\n\t\tif (credential.usageScope === 'instance') {\n\t\t\tif (\n\t\t\t\tcredential.isGlobal ||\n\t\t\t\tcredential.isResolvable ||\n\t\t\t\tcredential.isManaged ||\n\t\t\t\tcredential.resolvableAllowFallback ||\n\t\t\t\tcredential.resolverId\n\t\t\t) {\n\t\t\t\tthrow new UserError(\n\t\t\t\t\t'Provider connections cannot be global, managed, or dynamically resolved',\n\t\t\t\t);\n\t\t\t}\n\t\t\tObject.assign(credential, {\n\t\t\t\tisGlobal: false,\n\t\t\t\tisResolvable: false,\n\t\t\t\tisManaged: false,\n\t\t\t\tresolvableAllowFallback: false,\n\t\t\t\tresolverId: null,\n\t\t\t});\n\t\t\tawait this.validateInstanceCredentialData(transactionManager, credential, existing, ctx);\n\t\t}\n\n\t\tconst result = await transactionManager.upsert(CredentialsEntity, credential, ['id']);\n\t\tconst credentialsId = credential.id ?? (result.identifiers[0].id as string);\n\n\t\tif (credential.usageScope === 'instance') {\n\t\t\t// Instance credentials are instance-owned and must not retain project sharing rows.","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/cli/src/commands/import/credentials.ts#L182-L218","documentation":"Thrown by `import:credentials` when a credential being imported has `usageScope === 'instance'` AND any of the resolver/global/managed flags is set (isGlobal, isResolvable, isManaged, resolvableAllowFallback, resolverId). Instance-scope provider connections are simple credentials that do not participate in the dynamic resolution / managed / global credential system — those features are for project-scope credentials.","triggerScenarios":"Import JSON sets `usageScope: \"instance\"` alongside `isGlobal: true`, `resolverId: \"...\"`, `isManaged: true`, etc. The check at credentials.ts:192-203 fires before the credential is upserted.","commonSituations":"Hand-crafted JSON mixing incompatible credential features; exporting a project-scope managed credential and forcing instance scope on re-import; downstream tooling that sets all flags defensively.","solutions":["If the credential must be instance-scoped, remove all of: isGlobal, isResolvable, isManaged, resolvableAllowFallback, resolverId from the JSON.","If the credential must be global/managed/resolvable, set `usageScope: \"project\"` (or omit it — it defaults to 'project' at credentials.ts:190)."],"exampleFix":"// before\n{ \"usageScope\": \"instance\", \"isGlobal\": true, \"type\": \"...\" }\n// after\n{ \"usageScope\": \"instance\", \"type\": \"...\" }","handlingStrategy":"validation","validationCode":"function validateInstanceCredentialFlags(c: Partial<CredentialsEntity>) {\n  if (c.usageScope === 'instance') {\n    const incompatible = ['isGlobal', 'isResolvable', 'isManaged', 'resolvableAllowFallback', 'resolverId'] as const;\n    for (const key of incompatible) {\n      if (c[key]) throw new Error(`Instance credential cannot set ${key}`);\n    }\n  }\n}\nvalidateInstanceCredentialFlags(credential);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat instance-scope credentials as a separate, simpler category — no managed/global/resolver flags.","Validate credential JSON against the usageScope before import."],"tags":["cli","import","credentials","instance-scope","provider-connection","flags","user-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}