n8n-io/n8n · error · UserError

No credentials found with specified filters

Error message

No credentials found with specified filters

What it means

The `n8n export:credentials` command throws UserError('No credentials found with specified filters') when the query (with all --all/--only-id/--type filters applied) returns zero credentials. Prevents writing an empty export file silently.

Source

Thrown at packages/cli/src/commands/export/credentials.ts:136

		}

		const credentials: ICredentialsDb[] = await Container.get(CredentialsRepository).find({
			where: this.getWhereFilter(flags),
			relations: ['shared.project'],
		});

		if (flags.decrypted) {
			for (let i = 0; i < credentials.length; i++) {
				const { name, type, data } = credentials[i];
				const id = credentials[i].id;
				const credential = new Credentials({ id, name }, type, data);
				const plainData = await credential.getData();
				(credentials[i] as ICredentialsDecryptedDb).data = plainData;
			}
		}

		if (credentials.length === 0) {
			throw new UserError('No credentials found with specified filters');
		}

		if (flags.separate) {
			let fileContents: string;
			let i: number;
			for (i = 0; i < credentials.length; i++) {
				fileContents = JSON.stringify(credentials[i], null, flags.pretty ? 2 : undefined);
				const filename = `${
					(flags.output!.endsWith(path.sep) ? flags.output : flags.output + path.sep) +
					credentials[i].id
				}.json`;
				fs.writeFileSync(filename, fileContents);
			}
			this.logger.info(`Successfully exported ${i} credentials.`);
		} else {
			const fileContents = JSON.stringify(credentials, null, flags.pretty ? 2 : undefined);
			if (flags.output) {
				fs.writeFileSync(flags.output, fileContents);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Drop or correct the filters (e.g. remove --type) and re-run to confirm credentials exist.
  2. Verify you are querying the correct n8n database (N8N_DEFAULT_BINARY_DATA_MODE / DB env vars).
  3. List credentials first: `n8n list:credential` to confirm IDs/types before exporting.

Example fix

# before
n8n export:credentials --type=nonExistentType --output=./out.json

# after
n8n list:credential   # confirm available types/ids
n8n export:credentials --all --output=./out.json
Defensive patterns

Strategy: validation

Validate before calling

// Before exporting, confirm credentials exist
const list = await credentialRepository.find(); // with same filters
if (list.length === 0) { /* surface 'no credentials' without invoking export */ }

Type guard

function isNoCredentialsError(error: unknown): boolean {
  return error instanceof Error && error.message === 'No credentials found with specified filters';
}

Try / catch

try {
  await ExportCredentials.run(argv);
} catch (e) {
  if (isNoCredentialsError(e)) { /* list credentials, adjust filters, retry */ }
  else throw e;
}

Prevention

When it happens

Trigger: Running `n8n export:credentials` with filters that match nothing: a --type that has no instances, or no credentials exist at all in the DB.

Common situations: Fresh instance with no credentials; --type filter typo; credentials owned by a different user not visible to the querying context; DB pointing at the wrong n8n instance.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/e0d3422b2d0c0a2a. Report an issue: GitHub.