{"record":{"id":"23e178e3c7a66254","repo":"Mintplex-Labs/anything-llm","slug":"type-type-is-not-a-valid-type-to-sync","errorCode":null,"errorMessage":"Type \"${type}\" is not a valid type to sync.","messagePattern":"Type \"(.+?)\" is not a valid type to sync\\.","errorType":"validation","errorClass":"Error","httpStatus":200,"severity":"error","filePath":"collector/extensions/index.js","lineNumber":22,"sourceCode":"  resolveRepoLoader,\n  resolveRepoLoaderFunction,\n} = require(\"../utils/extensions/RepoLoader\");\nconst { reqBody } = require(\"../utils/http\");\nconst { validURL, validateURL } = require(\"../utils/url\");\nconst RESYNC_METHODS = require(\"./resync\");\nconst { loadObsidianVault } = require(\"../utils/extensions/ObsidianVault\");\n\nfunction extensions(app) {\n  if (!app) return;\n\n  app.post(\n    \"/ext/resync-source-document\",\n    [verifyPayloadIntegrity, setDataSigner],\n    async function (request, response) {\n      try {\n        const { type, options } = reqBody(request);\n        if (!RESYNC_METHODS.hasOwnProperty(type))\n          throw new Error(`Type \"${type}\" is not a valid type to sync.`);\n        return await RESYNC_METHODS[type](options, response);\n      } catch (e) {\n        console.error(e);\n        response.status(200).json({\n          success: false,\n          content: null,\n          reason: e.message || \"A processing error occurred.\",\n        });\n      }\n      return;\n    }\n  );\n\n  app.post(\n    \"/ext/:repo_platform-repo\",\n    [verifyPayloadIntegrity, setDataSigner],\n    async function (request, response) {\n      try {","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/collector/extensions/index.js#L4-L40","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before (server/.env)\nVECTOR_DB=lancedb\nPINECONE_API_KEY=pc-...\nPINECONE_INDEX=my-index\n\n# after (server/.env)\nVECTOR_DB=pinecone\nPINECONE_API_KEY=pc-...\nPINECONE_INDEX=my-index\n# then restart: docker compose down && up, or restart `yarn dev:server`","handlingStrategy":"validation","validationCode":"const isPineconeSelected = () => process.env.VECTOR_DB === 'pinecone';\nconst pineconeConfigComplete = () =>\n  isPineconeSelected() &&\n  Boolean(process.env.PINECONE_API_KEY) &&\n  Boolean(process.env.PINECONE_INDEX);\n\nif (!pineconeConfigComplete()) {\n  // do not call PineconeDB methods; VECTOR_DB is unset or another provider is active\n  throw new Error(`Vector provider misconfigured: VECTOR_DB=${process.env.VECTOR_DB ?? 'unset'}`);\n}","typeGuard":"function isPineconeEnv(env = process.env) {\n  return (\n    env.VECTOR_DB === 'pinecone' &&\n    typeof env.PINECONE_API_KEY === 'string' &&\n    env.PINECONE_API_KEY.length > 0 &&\n    typeof env.PINECONE_INDEX === 'string' &&\n    env.PINECONE_INDEX.length > 0\n  );\n}","tryCatchPattern":"try {\n  await vectorDB.heartbeat();\n} catch (e) {\n  if (/Invalid ENV settings/.test(e.message)) {\n    // permanent config error — fix .env and restart; do NOT retry\n    throw new Error('Set VECTOR_DB=pinecone in server/.env and restart the server');\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["pinecone","configuration","env-vars","vector-db","startup"],"backgroundTag":"missing-env-var","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}