Mintplex-Labs/anything-llm · error

Workspace does not exist.

Error message

Workspace does not exist.

What it means

Existence guard in validWorkspaceSlug middleware: no workspace matches the URL slug (in multi-user mode, scoped to the requesting user), so the route param is invalid and a 404 is returned before the handler runs.

Source

Thrown at server/utils/middleware/validWorkspace.js:14

const { Workspace } = require("../../models/workspace");
const { WorkspaceThread } = require("../../models/workspaceThread");
const { userFromSession, multiUserMode } = require("../http");

// Will pre-validate and set the workspace for a request if the slug is provided in the URL path.
async function validWorkspaceSlug(request, response, next) {
  const { slug } = request.params;
  const user = await userFromSession(request, response);
  const workspace = multiUserMode(response)
    ? await Workspace.getWithUser(user, { slug })
    : await Workspace.get({ slug });

  if (!workspace) {
    response.status(404).send("Workspace does not exist.");
    return;
  }

  response.locals.workspace = workspace;
  next();
}

// Will pre-validate and set the workspace AND a thread for a request if the slugs are provided in the URL path.
async function validWorkspaceAndThreadSlug(request, response, next) {
  const { slug, threadSlug } = request.params;
  const user = await userFromSession(request, response);
  const workspace = multiUserMode(response)
    ? await Workspace.getWithUser(user, { slug })
    : await Workspace.get({ slug });

  if (!workspace) {
    response.status(404).send("Workspace does not exist.");
    return;

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Check the workspace slug in the URL — it must exactly match an existing workspace slug.
  2. In multi-user mode, verify the requesting user has access to that workspace.
  3. Create the workspace first if it does not exist.
Defensive patterns

Strategy: validation

When it happens

Trigger: Request referenced a workspace that does not exist. Triggered when validWorkspace middleware cannot find the workspace by slug/id (validWorkspace.js:14).

Common situations: See trigger scenarios.


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/1419d11efc191b00. Report an issue: GitHub.