Mintplex-Labs/anything-llm · warning · Error

Namespace by that name does not exist.

Error message

Namespace by that name does not exist.

What it means

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.

Source

Thrown at server/utils/vectorDbProviders/chroma/index.js:421

        ...metadata,
        text: contextTexts[i],
        score: scores?.[i] || null,
      },
    }));

    return {
      contextTexts,
      sources: this.curateSources(sources),
      message: false,
    };
  }

  async "namespace-stats"(reqBody = {}) {
    const { namespace = null } = reqBody;
    if (!namespace) throw new Error("namespace required");
    const { client } = await this.connect();
    if (!(await this.namespaceExists(client, this.normalize(namespace))))
      throw new Error("Namespace by that name does not exist.");
    const stats = await this.namespace(client, this.normalize(namespace));
    return stats
      ? stats
      : { message: "No stats were able to be fetched from DB for namespace" };
  }

  async "delete-namespace"(reqBody = {}) {
    const { namespace = null } = reqBody;
    const { client } = await this.connect();
    if (!(await this.namespaceExists(client, this.normalize(namespace))))
      throw new Error("Namespace by that name does not exist.");

    const details = await this.namespace(client, this.normalize(namespace));
    await this.deleteVectorsInNamespace(client, this.normalize(namespace));
    return {
      message: `Namespace ${namespace} was deleted along with ${details?.vectorCount} vectors.`,
    };
  }

View on GitHub (pinned to 20f6d3546c)

Solutions

  1. Embed at least one document into the workspace first, then re-run stats.
  2. Use the exact workspace slug and remember normalization rewrites invalid characters (this.normalize) - prefer slugs that are already lowercase-alphanumeric.
  3. If Chroma was reset externally, re-embed all workspace documents.
  4. Treat the throw as an expected 'empty' case in tooling and show zero-vector stats instead of an error.

Example fix

// before
const stats = await VectorDb['namespace-stats']({ namespace });

// after
try {
  const stats = await VectorDb['namespace-stats']({ namespace });
} catch (e) {
  if (e.message === 'Namespace by that name does not exist.') return { vectorCount: 0 };
  throw e;
}
Defensive patterns

Strategy: validation

Validate before calling

async function safeNamespaceStats(vectorDb, namespace) {
  try {
    return await vectorDb['namespace-stats']({ namespace });
  } catch (e) {
    if (/does not exist/i.test(e.message)) return { vectorCount: 0, exists: false };
    throw e;
  }
}

Try / catch

try {
  const stats = await VectorDb['namespace-stats']({ namespace });
} catch (e) {
  if (/Namespace by that name does not exist/i.test(e.message)) {
    // expected for empty workspaces - report zero vectors, do not crash tooling
    return { vectorCount: 0 };
  }
  throw e;
}

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18). Data as JSON: /api/errors/665818bf6b52f669. Report an issue: GitHub.