{"record":{"id":"6d82b1f50526cf52","repo":"Mintplex-Labs/anything-llm","slug":"chroma-invalid-env-settings","errorCode":null,"errorMessage":"Chroma::Invalid ENV settings","messagePattern":"Chroma::Invalid ENV settings","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/vectorDbProviders/chroma/index.js","lineNumber":69,"sourceCode":"    // Ensure the length is between 3 and 63 characters\n    if (normalized.length < 3) {\n      normalized = `anythingllm-${normalized}`;\n    } else if (normalized.length > 63) {\n      // Recheck the norm'd name if sliced since its ending can still be invalid.\n      normalized = this.normalize(normalized.slice(0, 63));\n    }\n\n    // Ensure the name is not an IPv4 address\n    if (/^\\d+\\.\\d+\\.\\d+\\.\\d+$/.test(normalized)) {\n      normalized = \"-\" + normalized.slice(1);\n    }\n\n    return normalized;\n  }\n\n  async connect() {\n    if (process.env.VECTOR_DB !== \"chroma\")\n      throw new Error(\"Chroma::Invalid ENV settings\");\n\n    const client = new ChromaClient({\n      path: process.env.CHROMA_ENDPOINT, // if not set will fallback to localhost:8000\n      ...(!!process.env.CHROMA_API_HEADER && !!process.env.CHROMA_API_KEY\n        ? {\n            fetchOptions: {\n              headers: parseAuthHeader(\n                process.env.CHROMA_API_HEADER || \"X-Api-Key\",\n                process.env.CHROMA_API_KEY\n              ),\n            },\n          }\n        : {}),\n    });\n\n    const isAlive = await client.heartbeat();\n    if (!isAlive)\n      throw new Error(","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/utils/vectorDbProviders/chroma/index.js#L51-L87","documentation":"ChromaVectorDb.connect() starts with a hard guard: if process.env.VECTOR_DB !== 'chroma' it throws before touching the network. The Chroma provider class must only be used when the whole app is configured for Chroma; this catches miswired selection between the vector-db factory and the env variable.","triggerScenarios":"ChromaVectorDb methods invoked while VECTOR_DB is set to another provider (lance, pinecone, qdrant...) - typically because code instantiated the Chroma class directly, or VECTOR_DB was changed in .env without restarting so the running process still holds a stale value that no longer matches the selected provider.","commonSituations":"Switching VECTOR_DB in .env and hot-reloading only part of the app; scripts/tests that require the chroma provider without setting VECTOR_DB; docker containers where one process was restarted with the new env and another was not.","solutions":["Set VECTOR_DB=chroma in server/.env together with CHROMA_ENDPOINT (and CHROMA_API_HEADER/CHROMA_API_KEY if authenticated).","Restart the entire server (all containers) so every process reads the same env.","If writing custom code, obtain the provider from the vector-db selection layer instead of requiring vectorDbProviders/chroma directly.","Print process.env.VECTOR_DB at the failure site to confirm the runtime value."],"exampleFix":"// before (custom script)\nconst { ChromaVectorDb } = require('./server/utils/vectorDbProviders/chroma');\nconst db = new ChromaVectorDb(); // throws if VECTOR_DB != 'chroma'\n\n// after\nprocess.env.VECTOR_DB = 'chroma';\nprocess.env.CHROMA_ENDPOINT = 'http://localhost:8000';\nconst db = new ChromaVectorDb();","handlingStrategy":"validation","validationCode":"function requireChromaProvider() {\n  if (process.env.VECTOR_DB !== 'chroma') {\n    throw new Error(`VECTOR_DB must be 'chroma' to use ChromaVectorDb (got '${process.env.VECTOR_DB}').`);\n  }\n  if (!process.env.CHROMA_ENDPOINT) throw new Error('CHROMA_ENDPOINT is required.');\n}","typeGuard":"function isChromaConfigured() {\n  return process.env.VECTOR_DB === 'chroma' && !!process.env.CHROMA_ENDPOINT;\n}","tryCatchPattern":null,"preventionTips":["Select vector providers only through the factory keyed on VECTOR_DB; never require a provider module directly.","Restart all processes after changing VECTOR_DB so no process holds a stale value.","Assert provider/env agreement in a boot-time sanity check."],"tags":["chroma","vector-db","env","configuration"],"backgroundTag":"env-config-mismatch","analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}