n8n-io/n8n · error · UserError
Provider connection data cannot be empty
Error message
Provider connection data cannot be empty
What it means
Thrown by validateInstanceCredentialData when an instance-scope credential's `data` field is null or an empty string. Instance credentials require a non-empty JSON data payload — they cannot be placeholders.
Source
Thrown at packages/cli/src/commands/import/credentials.ts:258
private async validateInstanceCredentialData(
transactionManager: EntityManager,
credential: Partial<CredentialsEntity>,
existing: Pick<CredentialsEntity, 'id' | 'type' | 'usageScope'> | null,
ctx: OperationContext,
) {
let data: unknown = credential.data;
if (data === undefined && credential.id) {
data = (
await transactionManager.findOne(CredentialsEntity, {
where: { id: credential.id },
select: { data: true },
})
)?.data;
}
if (data === undefined) return;
if (data === null || data === '') {
throw new UserError('Provider connection data cannot be empty');
}
const decrypted =
typeof data === 'string'
? jsonParse<unknown>(await Container.get(Cipher).decryptV2(data))
: data;
if (!isCredentialData(decrypted)) {
throw new UserError('Provider connection data must be a JSON object');
}
const credentialsService = Container.get(CredentialsService);
if (existing?.usageScope === 'instance') {
await credentialsService.validateInstanceCredentialUpdate(
existing,
decrypted,
undefined,
ctx,
);
} else {View on GitHub (pinned to 5ac6606e81)
Solutions
- Provide a valid non-empty `data` object in the import JSON for the instance credential.
- If updating only some fields, ensure the existing DB credential has non-empty data — repair it first via the UI.
Example fix
// before
{ "id": "x", "usageScope": "instance", "data": null }
// after
{ "id": "x", "usageScope": "instance", "data": { "apiKey": "..." } } Defensive patterns
Strategy: validation
Validate before calling
function hasNonEmptyData(c: Partial<CredentialsEntity>): boolean {
if (c.usageScope !== 'instance') return true;
return c.data !== null && c.data !== '' && c.data !== undefined;
}
if (!hasNonEmptyData(credential)) {
throw new Error('Instance credential requires non-empty data');
} Prevention
- Always include a populated `data` object for instance credentials in import JSON.
- Don't strip the data field during export if you intend to re-import as instance scope.
When it happens
Trigger: Import JSON has `usageScope: "instance"` and either `data: null`, `data: ""`, or the existing DB row's data (fetched at credentials.ts:248-254 when import data is undefined) is null/empty.
Common situations: Export that stripped data for security; partial import updating only metadata of an instance credential whose DB row has null data; hand-editing a credential JSON and clearing the data field.
Related errors
- Provider connection data must be a JSON object
- Provider connection type cannot be changed. Create a new con
- Provider connections cannot be global, managed, or dynamical
- File does not seem to contain credentials. Make sure the cre
- ${flagName} must contain at least one property name.
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/141e04ec331b4fa9.
Report an issue: GitHub.