Mintplex-Labs/anything-llm · error · Error

Chroma::Invalid ENV settings

Error message

Chroma::Invalid ENV settings

What it means

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.

Source

Thrown at server/utils/vectorDbProviders/chroma/index.js:69

    // Ensure the length is between 3 and 63 characters
    if (normalized.length < 3) {
      normalized = `anythingllm-${normalized}`;
    } else if (normalized.length > 63) {
      // Recheck the norm'd name if sliced since its ending can still be invalid.
      normalized = this.normalize(normalized.slice(0, 63));
    }

    // Ensure the name is not an IPv4 address
    if (/^\d+\.\d+\.\d+\.\d+$/.test(normalized)) {
      normalized = "-" + normalized.slice(1);
    }

    return normalized;
  }

  async connect() {
    if (process.env.VECTOR_DB !== "chroma")
      throw new Error("Chroma::Invalid ENV settings");

    const client = new ChromaClient({
      path: process.env.CHROMA_ENDPOINT, // if not set will fallback to localhost:8000
      ...(!!process.env.CHROMA_API_HEADER && !!process.env.CHROMA_API_KEY
        ? {
            fetchOptions: {
              headers: parseAuthHeader(
                process.env.CHROMA_API_HEADER || "X-Api-Key",
                process.env.CHROMA_API_KEY
              ),
            },
          }
        : {}),
    });

    const isAlive = await client.heartbeat();
    if (!isAlive)
      throw new Error(

View on GitHub (pinned to 20f6d3546c)

Solutions

  1. Set VECTOR_DB=chroma in server/.env together with CHROMA_ENDPOINT (and CHROMA_API_HEADER/CHROMA_API_KEY if authenticated).
  2. Restart the entire server (all containers) so every process reads the same env.
  3. If writing custom code, obtain the provider from the vector-db selection layer instead of requiring vectorDbProviders/chroma directly.
  4. Print process.env.VECTOR_DB at the failure site to confirm the runtime value.

Example fix

// before (custom script)
const { ChromaVectorDb } = require('./server/utils/vectorDbProviders/chroma');
const db = new ChromaVectorDb(); // throws if VECTOR_DB != 'chroma'

// after
process.env.VECTOR_DB = 'chroma';
process.env.CHROMA_ENDPOINT = 'http://localhost:8000';
const db = new ChromaVectorDb();
Defensive patterns

Strategy: validation

Validate before calling

function requireChromaProvider() {
  if (process.env.VECTOR_DB !== 'chroma') {
    throw new Error(`VECTOR_DB must be 'chroma' to use ChromaVectorDb (got '${process.env.VECTOR_DB}').`);
  }
  if (!process.env.CHROMA_ENDPOINT) throw new Error('CHROMA_ENDPOINT is required.');
}

Type guard

function isChromaConfigured() {
  return process.env.VECTOR_DB === 'chroma' && !!process.env.CHROMA_ENDPOINT;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18). Data as JSON: /api/errors/6d82b1f50526cf52. Report an issue: GitHub.