{"record":{"id":"82a93bffb17acb73","repo":"Mintplex-Labs/anything-llm","slug":"weaviate-invalid-env-settings","errorCode":null,"errorMessage":"Weaviate::Invalid ENV settings","messagePattern":"Weaviate::Invalid ENV settings","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/utils/vectorDbProviders/weaviate/index.js","lineNumber":22,"sourceCode":"const { storeVectorResult, cachedVectorInformation } = require(\"../../files\");\nconst { v4: uuidv4 } = require(\"uuid\");\nconst { toChunks, getEmbeddingEngineSelection } = require(\"../../helpers\");\nconst { camelCase } = require(\"../../helpers/camelcase\");\nconst { sourceIdentifier } = require(\"../../chats\");\nconst { VectorDatabase } = require(\"../base\");\n\nclass Weaviate extends VectorDatabase {\n  constructor() {\n    super();\n  }\n\n  get name() {\n    return \"Weaviate\";\n  }\n\n  async connect() {\n    if (process.env.VECTOR_DB !== \"weaviate\")\n      throw new Error(\"Weaviate::Invalid ENV settings\");\n\n    const weaviateUrl = new URL(process.env.WEAVIATE_ENDPOINT);\n    const options = {\n      scheme: weaviateUrl.protocol?.replace(\":\", \"\") || \"http\",\n      host: weaviateUrl?.host,\n      ...(process.env?.WEAVIATE_API_KEY?.length > 0\n        ? { apiKey: new weaviate.ApiKey(process.env?.WEAVIATE_API_KEY) }\n        : {}),\n    };\n    const client = weaviate.client(options);\n    const isAlive = await await client.misc.liveChecker().do();\n    if (!isAlive)\n      throw new Error(\n        \"Weaviate::Invalid Alive signal received - is the service online?\"\n      );\n    return { client };\n  }\n","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/vectorDbProviders/weaviate/index.js#L4-L40","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set VECTOR_DB=\"weaviate\" (exact lowercase) in server/.env next to WEAVIATE_ENDPOINT","Fully restart the AnythingLLM server/container after saving .env so process.env is re-read","If using the provider in a script/test, load env first: require('dotenv').config() or export VECTOR_DB=weaviate in the shell","Strip stray quotes/spaces from .env values and confirm docker-compose actually passes the variable into the container"],"exampleFix":"# before (.env)\nVECTOR_DB=Weaviate\n\n# after (.env)\nVECTOR_DB=weaviate\nWEAVIATE_ENDPOINT=http://localhost:8080","handlingStrategy":"validation","validationCode":"function canUseWeaviate() {\n  return process.env.VECTOR_DB === \"weaviate\" && !!process.env.WEAVIATE_ENDPOINT;\n}\nif (!canUseWeaviate()) throw new Error(\"Configure VECTOR_DB=weaviate and WEAVIATE_ENDPOINT first\");","typeGuard":null,"tryCatchPattern":"try {\n  const { client } = await weaviate.connect();\n} catch (e) {\n  if (e.message.includes(\"Invalid ENV settings\")) { fixVectorDbEnv(); return; }\n  throw e;\n}","preventionTips":["Validate required env pairs at boot and fail with a listing of missing keys instead of at first connect","Use exact lowercase provider ids in VECTOR_DB — the comparison is case-sensitive","Reload/restart the process (or container) after every .env change before testing providers"],"tags":["weaviate","vector-db","environment","configuration"],"backgroundTag":"invalid-env-var","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}