{"record":{"id":"665818bf6b52f669","repo":"Mintplex-Labs/anything-llm","slug":"namespace-by-that-name-does-not-exist","errorCode":null,"errorMessage":"Namespace by that name does not exist.","messagePattern":"Namespace by that name does not exist\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/utils/vectorDbProviders/chroma/index.js","lineNumber":421,"sourceCode":"        ...metadata,\n        text: contextTexts[i],\n        score: scores?.[i] || null,\n      },\n    }));\n\n    return {\n      contextTexts,\n      sources: this.curateSources(sources),\n      message: false,\n    };\n  }\n\n  async \"namespace-stats\"(reqBody = {}) {\n    const { namespace = null } = reqBody;\n    if (!namespace) throw new Error(\"namespace required\");\n    const { client } = await this.connect();\n    if (!(await this.namespaceExists(client, this.normalize(namespace))))\n      throw new Error(\"Namespace by that name does not exist.\");\n    const stats = await this.namespace(client, this.normalize(namespace));\n    return stats\n      ? stats\n      : { message: \"No stats were able to be fetched from DB for namespace\" };\n  }\n\n  async \"delete-namespace\"(reqBody = {}) {\n    const { namespace = null } = reqBody;\n    const { client } = await this.connect();\n    if (!(await this.namespaceExists(client, this.normalize(namespace))))\n      throw new Error(\"Namespace by that name does not exist.\");\n\n    const details = await this.namespace(client, this.normalize(namespace));\n    await this.deleteVectorsInNamespace(client, this.normalize(namespace));\n    return {\n      message: `Namespace ${namespace} was deleted along with ${details?.vectorCount} vectors.`,\n    };\n  }","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/utils/vectorDbProviders/chroma/index.js#L403-L439","documentation":"In ChromaVectorDb['namespace-stats'], after the namespace-required guard passes and connect() succeeds, namespaceExists() is checked; when no collection with that normalized name exists the method throws 'Namespace by that name does not exist.' A namespace only exists once at least one document has been embedded into that workspace.","triggerScenarios":"Querying stats for a workspace with zero embedded documents, a deleted/reset Chroma instance, a typo'd or pre-normalization slug (uppercase or invalid chars transformed by this.normalize()), or a namespace that was explicitly deleted via 'delete-namespace'.","commonSituations":"Fresh workspace before the first upload completes; Chroma data volume wiped; querying with the workspace name while the collection is stored under the normalized slug; stats checked right after deleting a namespace.","solutions":["Embed at least one document into the workspace first, then re-run stats.","Use the exact workspace slug and remember normalization rewrites invalid characters (this.normalize) - prefer slugs that are already lowercase-alphanumeric.","If Chroma was reset externally, re-embed all workspace documents.","Treat the throw as an expected 'empty' case in tooling and show zero-vector stats instead of an error."],"exampleFix":"// before\nconst stats = await VectorDb['namespace-stats']({ namespace });\n\n// after\ntry {\n  const stats = await VectorDb['namespace-stats']({ namespace });\n} catch (e) {\n  if (e.message === 'Namespace by that name does not exist.') return { vectorCount: 0 };\n  throw e;\n}","handlingStrategy":"validation","validationCode":"async function safeNamespaceStats(vectorDb, namespace) {\n  try {\n    return await vectorDb['namespace-stats']({ namespace });\n  } catch (e) {\n    if (/does not exist/i.test(e.message)) return { vectorCount: 0, exists: false };\n    throw e;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const stats = await VectorDb['namespace-stats']({ namespace });\n} catch (e) {\n  if (/Namespace by that name does not exist/i.test(e.message)) {\n    // expected for empty workspaces - report zero vectors, do not crash tooling\n    return { vectorCount: 0 };\n  }\n  throw e;\n}","preventionTips":["Treat not-found as an empty result in dashboards/scripts instead of an error path.","Confirm the workspace has completed at least one embed before querying stats.","Match the exact workspace slug; remember normalization rewrites invalid characters."],"tags":["chroma","vector-db","namespace","not-found","developer-tools"],"backgroundTag":"resource-not-found","analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}