Mintplex-Labs/anything-llm · error

Weaviate::Invalid ENV settings

Error message

Weaviate::Invalid ENV settings

What it means

Weaviate's connect() refuses to run unless process.env.VECTOR_DB is exactly "weaviate". It is a fail-fast guard so the provider is only used when the app was actually configured for Weaviate; any other value (chroma, qdrant, lance, unset, or different casing) throws before any network call is made.

Source

Thrown at server/utils/vectorDbProviders/weaviate/index.js:22

const { storeVectorResult, cachedVectorInformation } = require("../../files");
const { v4: uuidv4 } = require("uuid");
const { toChunks, getEmbeddingEngineSelection } = require("../../helpers");
const { camelCase } = require("../../helpers/camelcase");
const { sourceIdentifier } = require("../../chats");
const { VectorDatabase } = require("../base");

class Weaviate extends VectorDatabase {
  constructor() {
    super();
  }

  get name() {
    return "Weaviate";
  }

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

    const weaviateUrl = new URL(process.env.WEAVIATE_ENDPOINT);
    const options = {
      scheme: weaviateUrl.protocol?.replace(":", "") || "http",
      host: weaviateUrl?.host,
      ...(process.env?.WEAVIATE_API_KEY?.length > 0
        ? { apiKey: new weaviate.ApiKey(process.env?.WEAVIATE_API_KEY) }
        : {}),
    };
    const client = weaviate.client(options);
    const isAlive = await await client.misc.liveChecker().do();
    if (!isAlive)
      throw new Error(
        "Weaviate::Invalid Alive signal received - is the service online?"
      );
    return { client };
  }

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Set VECTOR_DB="weaviate" (exact lowercase) in server/.env next to WEAVIATE_ENDPOINT
  2. Fully restart the AnythingLLM server/container after saving .env so process.env is re-read
  3. If using the provider in a script/test, load env first: require('dotenv').config() or export VECTOR_DB=weaviate in the shell
  4. Strip stray quotes/spaces from .env values and confirm docker-compose actually passes the variable into the container

Example fix

# before (.env)
VECTOR_DB=Weaviate

# after (.env)
VECTOR_DB=weaviate
WEAVIATE_ENDPOINT=http://localhost:8080
Defensive patterns

Strategy: validation

Validate before calling

function canUseWeaviate() {
  return process.env.VECTOR_DB === "weaviate" && !!process.env.WEAVIATE_ENDPOINT;
}
if (!canUseWeaviate()) throw new Error("Configure VECTOR_DB=weaviate and WEAVIATE_ENDPOINT first");

Try / catch

try {
  const { client } = await weaviate.connect();
} catch (e) {
  if (e.message.includes("Invalid ENV settings")) { fixVectorDbEnv(); return; }
  throw e;
}

Prevention

When it happens

Trigger: Anything that reaches Weaviate.connect() while VECTOR_DB != "weaviate": a typo'd or unset VECTOR_DB value, a .env edit that was never reloaded, or importing/instantiating the provider directly in a test or script without the server environment loaded.

Common situations: VECTOR_DB=Weaviate (capitalized — the check is case-sensitive); docker container started without the env file/passing env vars; running unit tests against the provider class without dotenv; .env changed but the Node process not restarted.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/82a93bffb17acb73. Report an issue: GitHub.