Mintplex-Labs/anything-llm · warning · Error

namespace required

Error message

namespace required

What it means

ChromaVectorDb's 'namespace-stats' command (invoked through the developer/tools endpoints that dispatch VectorDb['namespace-stats']) throws 'namespace required' when reqBody.namespace is null/absent. It is a request-shape guard: the dispatcher expects { namespace: '<workspace-slug>' }.

Source

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

    const sources = sourceDocuments.map((metadata, i) => ({
      metadata: {
        ...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 {

View on GitHub (pinned to 20f6d3546c)

Solutions

  1. Send { "namespace": "<workspace-slug>" } in the request body.
  2. Confirm the workspace slug via the UI (workspace URL) or the workspaces API before calling stats.
  3. In scripts, filter out falsy slugs before invoking the command.

Example fix

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

// after
const stats = await VectorDb['namespace-stats']({ namespace: workspace.slug });
Defensive patterns

Strategy: validation

Validate before calling

function normalizeNamespaceCommand(body) {
  const ns = body?.namespace?.trim();
  if (!ns) throw new Error("Request body must include a non-empty 'namespace' (workspace slug).");
  return { namespace: ns };
}

Type guard

function hasNamespace(body) {
  return typeof body?.namespace === 'string' && body.namespace.trim().length > 0;
}

Prevention

When it happens

Trigger: Calling the dev endpoint or VectorDb['namespace-stats']({}) / ({ namespace: null }) - missing key, undefined slug, or a payload built from a workspace that failed to load.

Common situations: Manual curl/Postman against /dev endpoints with an incomplete JSON body; automation scripts iterating workspaces where one record lacks a slug; renamed payload field (name vs namespace).

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — 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/e6410844870afa17. Report an issue: GitHub.