Mintplex-Labs/anything-llm · warning · Error

namespace required

Error message

namespace required

What it means

LanceVectorDb's 'namespace-stats' command destructures reqBody.namespace and throws 'namespace required' when it is absent. The command is dispatched from the developer tools endpoints and expects { namespace: '<workspace-slug>' } so it can look up the corresponding LanceDB table.

Source

Thrown at server/utils/vectorDbProviders/lance/index.js:471

          similarityThreshold,
          topN,
          filterIdentifiers,
        });

    const { contextTexts, sourceDocuments } = result;
    const sources = sourceDocuments.map((metadata, i) => {
      return { metadata: { ...metadata, text: contextTexts[i] } };
    });
    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, namespace)))
      throw new Error("Namespace by that name does not exist.");
    const stats = await this.namespace(client, 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, namespace)))
      throw new Error("Namespace by that name does not exist.");

    await this.deleteVectorsInNamespace(client, namespace);
    return {
      message: `Namespace ${namespace} was deleted.`,

View on GitHub (pinned to 20f6d3546c)

Solutions

  1. Include the workspace slug: { "namespace": "my-workspace" }.
  2. Look the slug up via the workspaces API or the workspace URL before calling.
  3. Filter falsy namespaces out of batch scripts before invoking stats.

Example fix

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

// after
await VectorDb['namespace-stats']({ namespace: 'my-workspace' });
Defensive patterns

Strategy: validation

Validate before calling

const ns = reqBody?.namespace?.trim();
if (!ns) throw new Error("Body must include non-empty 'namespace' (workspace slug).");
await VectorDb['namespace-stats']({ namespace: ns });

Type guard

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

Prevention

When it happens

Trigger: Calling VectorDb['namespace-stats']({}) or with an undefined/null namespace - incomplete request body from manual API calls or scripts iterating workspaces where a slug is missing.

Common situations: curl/Postman requests to the dev endpoint missing the namespace field; automation built against a different provider's payload shape; workspace records without slugs.

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/f8e5f9959a42717b. Report an issue: GitHub.