{"record":{"id":"b88db6d20d126fa6","repo":"n8n-io/n8n","slug":"failed-to-list-chromadb-collections-errormessag","errorCode":null,"errorMessage":"Failed to list ChromaDB collections: ${errorMessage}","messagePattern":"Failed to list ChromaDB collections: (.+?)","errorType":"exception","errorClass":"NodeApiError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.ts","lineNumber":379,"sourceCode":"\t\t\t\t\t\tthrow new NodeApiError(this.getNode(), {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t'Cannot connect to ChromaDB. Please ensure ChromaDB is running and accessible at the configured URL.',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check for authentication errors\n\t\t\t\t\tif (\n\t\t\t\t\t\terrorMessage.includes('Unauthorized') ||\n\t\t\t\t\t\terrorMessage.includes('401') ||\n\t\t\t\t\t\terrorMessage.includes('403')\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new NodeApiError(this.getNode(), {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t'Authentication failed. Please check your API key or token in the credentials',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new NodeApiError(this.getNode(), {\n\t\t\t\t\t\tmessage: `Failed to list ChromaDB collections: ${errorMessage}`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\tretrieveFields,\n\tloadFields: retrieveFields,\n\tinsertFields,\n\tsharedFields,\n\n\tasync getVectorStoreClient(context, _filter, embeddings, itemIndex) {\n\t\tconst collection = context.getNodeParameter('chromaCollection', itemIndex, '', {\n\t\t\textractValue: true,\n\t\t});\n\n\t\tif (typeof collection !== 'string') {\n\t\t\tthrow new NodeOperationError(context.getNode(), 'Collection must be a string');","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.ts#L361-L397","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the appended `errorMessage` — it is the raw SDK text and usually names the real problem.","If it is a 5xx, retry; if it is a 4xx, fix the offending collection metadata or name.","Reproduce the list call directly (`curl <url>/api/v1/collections`) to see the unmodified server response.","Extend the connection/auth matching above if the real error belongs to one of those buckets but uses different wording."],"exampleFix":"// before\nthrow new NodeApiError(this.getNode(), {\n  message: `Failed to list ChromaDB collections: ${errorMessage}`,\n});\n\n// after: also surface the HTTP status and hint bucket so the user self-serves\nthrow new NodeApiError(this.getNode(), {\n  message: `Failed to list ChromaDB collections: ${errorMessage}`,\n  description: `Status: ${status ?? 'n/a'}. If this is a connection or credentials issue, verify the URL and API key first.`,\n});","handlingStrategy":"try-catch","validationCode":"// Pre-flight: validate that the URL parses and the host resolves before listCollections.\nfunction preflightChromaUrl(url: string): URL {\n  let parsed: URL;\n  try { parsed = new URL(url); } catch { throw new Error('Invalid ChromaDB URL'); }\n  if (!/^https?:$/.test(parsed.protocol)) throw new Error(`Unsupported protocol ${parsed.protocol}`);\n  return parsed;\n}","typeGuard":"function isKnownBucket(error: unknown): 'connection' | 'auth' | 'unknown' {\n  if (!(error instanceof Error)) return 'unknown';\n  const m = error.message;\n  if (/ECONNREFUSED|ENOTFOUND|Failed to connect/.test(m)) return 'connection';\n  if (/Unauthorized|401|403/.test(m)) return 'auth';\n  return 'unknown';\n}","tryCatchPattern":"try {\n  return await chromaClient.listCollections();\n} catch (error) {\n  const bucket = isKnownBucket(error);\n  if (bucket !== 'unknown') throw bucketedError(node, bucket);\n  const msg = error instanceof Error ? error.message : String(error);\n  throw new NodeApiError(node, { message: `Failed to list ChromaDB collections: ${msg}` });\n}","preventionTips":["Reproduce list calls with curl to see the unmodified server response.","Log the full error (status + body) at debug level to extend bucketing later.","Keep the bucket list in sync with new Chroma SDK error wording."],"tags":["chromadb","vector-store","catch-all","node-api-error","langchain"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}