n8n-io/n8n · error · NodeApiError

Failed to list ChromaDB collections: ${errorMessage}

Error message

Failed to list ChromaDB collections: ${errorMessage}

What it means

Catch-all NodeApiError thrown by the Chroma collection listSearch when the underlying error matched neither the connection-error nor the authentication-error patterns. The original SDK message is appended so the user can see what ChromaDB actually returned.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.ts:379

						throw new NodeApiError(this.getNode(), {
							message:
								'Cannot connect to ChromaDB. Please ensure ChromaDB is running and accessible at the configured URL.',
						});
					}

					// Check for authentication errors
					if (
						errorMessage.includes('Unauthorized') ||
						errorMessage.includes('401') ||
						errorMessage.includes('403')
					) {
						throw new NodeApiError(this.getNode(), {
							message:
								'Authentication failed. Please check your API key or token in the credentials',
						});
					}

					throw new NodeApiError(this.getNode(), {
						message: `Failed to list ChromaDB collections: ${errorMessage}`,
					});
				}
			},
		},
	},
	retrieveFields,
	loadFields: retrieveFields,
	insertFields,
	sharedFields,

	async getVectorStoreClient(context, _filter, embeddings, itemIndex) {
		const collection = context.getNodeParameter('chromaCollection', itemIndex, '', {
			extractValue: true,
		});

		if (typeof collection !== 'string') {
			throw new NodeOperationError(context.getNode(), 'Collection must be a string');

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Read the appended `errorMessage` — it is the raw SDK text and usually names the real problem.
  2. If it is a 5xx, retry; if it is a 4xx, fix the offending collection metadata or name.
  3. Reproduce the list call directly (`curl <url>/api/v1/collections`) to see the unmodified server response.
  4. Extend the connection/auth matching above if the real error belongs to one of those buckets but uses different wording.

Example fix

// before
throw new NodeApiError(this.getNode(), {
  message: `Failed to list ChromaDB collections: ${errorMessage}`,
});

// after: also surface the HTTP status and hint bucket so the user self-serves
throw new NodeApiError(this.getNode(), {
  message: `Failed to list ChromaDB collections: ${errorMessage}`,
  description: `Status: ${status ?? 'n/a'}. If this is a connection or credentials issue, verify the URL and API key first.`,
});
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: validate that the URL parses and the host resolves before listCollections.
function preflightChromaUrl(url: string): URL {
  let parsed: URL;
  try { parsed = new URL(url); } catch { throw new Error('Invalid ChromaDB URL'); }
  if (!/^https?:$/.test(parsed.protocol)) throw new Error(`Unsupported protocol ${parsed.protocol}`);
  return parsed;
}

Type guard

function isKnownBucket(error: unknown): 'connection' | 'auth' | 'unknown' {
  if (!(error instanceof Error)) return 'unknown';
  const m = error.message;
  if (/ECONNREFUSED|ENOTFOUND|Failed to connect/.test(m)) return 'connection';
  if (/Unauthorized|401|403/.test(m)) return 'auth';
  return 'unknown';
}

Try / catch

try {
  return await chromaClient.listCollections();
} catch (error) {
  const bucket = isKnownBucket(error);
  if (bucket !== 'unknown') throw bucketedError(node, bucket);
  const msg = error instanceof Error ? error.message : String(error);
  throw new NodeApiError(node, { message: `Failed to list ChromaDB collections: ${msg}` });
}

Prevention

When it happens

Trigger: Any listCollections failure not containing ECONNREFUSED / Failed to connect / Unauthorized / 401 / 403 — e.g. 500 from ChromaDB, malformed collection metadata, SDK TypeError, CORS error from a browser-side call, or a rate-limit 429.

Common situations: ChromaDB version mismatch returning an unexpected shape; collection name with unsupported characters triggering a 4xx not in the matched list; SSL/TLS handshake failure reported as a generic Error; transient 5xx during server-side index rebuild.

Related errors


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