{"record":{"id":"c9623e9e192b5134","repo":"Mintplex-Labs/anything-llm","slug":"could-not-find-indexes","errorCode":null,"errorMessage":"Could not find indexes.","messagePattern":"Could not find indexes\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"frontend/src/models/system.js","lineNumber":29,"sourceCode":"    supportEmail: \"anythingllm_support_email\",\n    customAppName: \"anythingllm_custom_app_name\",\n    canViewChatHistory: \"anythingllm_can_view_chat_history\",\n    deploymentVersion: \"anythingllm_deployment_version\",\n  },\n  ping: async function () {\n    return await fetch(`${API_BASE}/ping`)\n      .then((res) => res.json())\n      .then((res) => res?.online || false)\n      .catch(() => false);\n  },\n  totalIndexes: async function (slug = null) {\n    const url = new URL(`${fullApiUrl()}/system/system-vectors`);\n    if (!!slug) url.searchParams.append(\"slug\", encodeURIComponent(slug));\n    return await fetch(url.toString(), {\n      headers: baseHeaders(),\n    })\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Could not find indexes.\");\n        return res.json();\n      })\n      .then((res) => res.vectorCount)\n      .catch(() => 0);\n  },\n\n  /**\n   * Checks if the onboarding is complete.\n   * @returns {Promise<boolean>}\n   */\n  isOnboardingComplete: async function () {\n    return await fetch(`${API_BASE}/onboarding`)\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Could not find onboarding information.\");\n        return res.json();\n      })\n      .then((res) => res.onboardingComplete)\n      .catch(() => false);","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/system.js#L11-L47","documentation":"Thrown by System.totalIndexes when the GET to {fullApiUrl()}/system/system-vectors (optionally ?slug=...) returns non-2xx. It reads the vector database index count for a workspace or instance. The .catch() returns 0, so a failure is indistinguishable from a genuinely empty vector store.","triggerScenarios":"Calling totalIndexes() or totalIndexes(\"my-workspace\") when the vector database is unreachable/misconfigured (500), when the slug does not match any workspace, or when the auth token is rejected (401/403).","commonSituations":"Vector DB provider (Pinecone/Chroma/Qdrant/Weaviate) credentials are unset or wrong in env; the embedding engine is configured but the vector DB is not; the workspace slug was renamed and the stale slug is passed.","solutions":["Check server logs for the /system/system-vectors handler, which surfaces the underlying vectorDB connection error.","Verify VectorDatabase provider env vars are set and the embedding engine is selected in system settings.","If passing a slug, confirm it matches a workspace returned by the workspaces listing endpoint.","Distinguish a real 0 from an error by temporarily removing the .catch(() => 0) during debugging."],"exampleFix":"// before\nconst count = await System.totalIndexes(slug); // 0 on error OR empty\n\n// after (debug: let it throw to see the real cause)\nconst res = await fetch(`${fullApiUrl()}/system/system-vectors` + (slug ? `?slug=${encodeURIComponent(slug)}` : \"\"), { headers: baseHeaders() });\nif (!res.ok) throw new Error(`vectors ${res.status}`);\nconst count = (await res.json()).vectorCount;","handlingStrategy":"fallback","validationCode":"// Validate slug shape if provided.\nfunction validSlug(slug) {\n  return slug == null || (typeof slug === \"string\" && /^[\\w-:]+$/.test(slug));\n}","typeGuard":"/** @param {any} n @returns {n is number} */\nfunction isNonNegativeInt(n) { return Number.isInteger(n) && n >= 0; }","tryCatchPattern":"const count = await System.totalIndexes(slug);\nconst safe = isNonNegativeInt(count) ? count : 0; // 0 may be error OR empty","preventionTips":["Do not assume 0 means empty — it may mean the request failed.","For debugging, temporarily bypass the library catch to see the real error.","Confirm vector DB provider env vars are set at deploy time."],"tags":["network","vector-db","embeddings","auth"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}