Mintplex-Labs/anything-llm · error · Error
Type " " is not a valid type to sync.
Error message
Type "${type}" is not a valid type to sync. What it means
Thrown by PineconeDB.connect() when process.env.VECTOR_DB is not exactly the lowercase string 'pinecone'. AnythingLLM instantiates one vector provider per app, and each provider self-guards so it cannot be used while the app is configured for a different backend. The throw happens before any Pinecone SDK call, so nothing leaves the process.
Solutions
- Set VECTOR_DB=pinecone in server/.env (exact lowercase) alongside PINECONE_API_KEY and PINECONE_INDEX, then fully restart the server/container so the env is re-read.
- Log process.env.VECTOR_DB from the exact process that instantiates PineconeDB to confirm which .env file was loaded and that the value has no whitespace/case issues.
- If you intentionally run a different VECTOR_DB, stop calling the Pinecone provider — check that the vector-db factory and any direct imports match your configuration.
- Add a fail-fast boot check: if VECTOR_DB=pinecone, assert PINECONE_API_KEY and PINECONE_INDEX are non-empty before the app starts serving.
Example fix
# before (server/.env) VECTOR_DB=lancedb PINECONE_API_KEY=pc-... PINECONE_INDEX=my-index # after (server/.env) VECTOR_DB=pinecone PINECONE_API_KEY=pc-... PINECONE_INDEX=my-index # then restart: docker compose down && up, or restart `yarn dev:server`
Defensive patterns
Strategy: validation
Validate before calling
const isPineconeSelected = () => process.env.VECTOR_DB === 'pinecone';
const pineconeConfigComplete = () =>
isPineconeSelected() &&
Boolean(process.env.PINECONE_API_KEY) &&
Boolean(process.env.PINECONE_INDEX);
if (!pineconeConfigComplete()) {
// do not call PineconeDB methods; VECTOR_DB is unset or another provider is active
throw new Error(`Vector provider misconfigured: VECTOR_DB=${process.env.VECTOR_DB ?? 'unset'}`);
} Type guard
function isPineconeEnv(env = process.env) {
return (
env.VECTOR_DB === 'pinecone' &&
typeof env.PINECONE_API_KEY === 'string' &&
env.PINECONE_API_KEY.length > 0 &&
typeof env.PINECONE_INDEX === 'string' &&
env.PINECONE_INDEX.length > 0
);
} Try / catch
try {
await vectorDB.heartbeat();
} catch (e) {
if (/Invalid ENV settings/.test(e.message)) {
// permanent config error — fix .env and restart; do NOT retry
throw new Error('Set VECTOR_DB=pinecone in server/.env and restart the server');
}
throw e;
} Prevention
- Keep VECTOR_DB as the single source of truth and instantiate providers only through the app's provider factory, never by direct import.
- Fail fast at boot: if VECTOR_DB=pinecone, assert PINECONE_API_KEY and PINECONE_INDEX are present before listening.
- Always restart (or recreate, for Docker) after editing .env so the new value is actually loaded.
- Add a CI/startup check that the .env value is one of the supported lowercase provider names.
When it happens
Trigger: Any code path that reaches PineconeDB.connect() (heartbeat, totalVectors, addDocumentToNamespace, namespace-stats, delete-namespace, performSimilaritySearch) while VECTOR_DB is unset or set to 'lancedb' (the default), 'chroma', 'qdrant', 'weaviate', 'milvus', 'pgvector', etc. Also triggered by importing/instantiating PineconeDB directly in a script that does not load server/.env.
Common situations: Adding PINECONE_API_KEY/PINECONE_INDEX to .env but forgetting VECTOR_DB=pinecone; editing .env without restarting the Node process or Docker container; VALUE case mismatch ('Pinecone'); stray quotes/whitespace in the env value; a test or utility script run with a different dotenv path than the server.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Chroma::Invalid ENV settings
- ChromaCloud::Invalid ENV settings
- Could not embed document chunks! This document will not be…
- ENV: No valid LLM_PROVIDER value found in environment! Using
- Weaviate::Invalid ENV settings
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/23e178e3c7a66254.
Report an issue: GitHub.
Appendix: source
Thrown at collector/extensions/index.js:22
resolveRepoLoader,
resolveRepoLoaderFunction,
} = require("../utils/extensions/RepoLoader");
const { reqBody } = require("../utils/http");
const { validURL, validateURL } = require("../utils/url");
const RESYNC_METHODS = require("./resync");
const { loadObsidianVault } = require("../utils/extensions/ObsidianVault");
function extensions(app) {
if (!app) return;
app.post(
"/ext/resync-source-document",
[verifyPayloadIntegrity, setDataSigner],
async function (request, response) {
try {
const { type, options } = reqBody(request);
if (!RESYNC_METHODS.hasOwnProperty(type))
throw new Error(`Type "${type}" is not a valid type to sync.`);
return await RESYNC_METHODS[type](options, response);
} catch (e) {
console.error(e);
response.status(200).json({
success: false,
content: null,
reason: e.message || "A processing error occurred.",
});
}
return;
}
);
app.post(
"/ext/:repo_platform-repo",
[verifyPayloadIntegrity, setDataSigner],
async function (request, response) {
try {View on GitHub (pinned to 3aec848f28)