Mintplex-Labs/anything-llm · warning

Workspace ${slug} not found.

Error message

Workspace ${slug} not found.

What it means

HTTP 404 from POST /api/v1/workspace/:slug/thread/:threadSlug/chat when the workspace lookup returns null. The response uses the abort shape {type:'abort', close:true, error:'Workspace <slug> not found.'} so streaming-capable clients can handle it uniformly. Note this endpoint 404s for a bad workspace while the non-thread workspace chat returns 400 for the same condition.

Source

Thrown at server/endpoints/api/workspaceThread/index.js:403

      }
      #swagger.responses[403] = {
        schema: {
          "$ref": "#/definitions/InvalidAPIKey"
        }
      }
      */
      try {
        const { slug, threadSlug } = request.params;
        const {
          message,
          mode = null,
          userId,
          attachments = [],
          reset = false,
        } = reqBody(request);
        const workspace = await Workspace.get({ slug: String(slug) });
        if (!workspace) {
          response.status(404).json({
            id: uuidv4(),
            type: "abort",
            textResponse: null,
            sources: [],
            close: true,
            error: `Workspace ${slug} not found.`,
          });
          return;
        }

        const thread = await WorkspaceThread.get({
          slug: String(threadSlug),
          workspace_id: workspace.id,
        });
        if (!thread) {
          response.status(404).json({
            id: uuidv4(),
            type: "abort",

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Validate the workspace slug with GET /api/v1/workspace/:slug before chatting
  2. Pull slugs from GET /api/v1/workspaces rather than hardcoding
  3. Handle the 404 abort body and prompt re-selection of the workspace
  4. Re-create the workspace or repoint to an existing one

Example fix

// before
await threadChat(slugFromEnv, threadSlug, message);
// after
if (!(await workspaceExists(slugFromEnv))) throw new Error(`workspace ${slugFromEnv} missing`);
await threadChat(slugFromEnv, threadSlug, message);
Defensive patterns

Strategy: validation

Validate before calling

if (!(await fetch(`${BASE}/api/v1/workspace/${slug}`, { headers: AUTH }).then(r => r.ok)))
  throw new Error(`workspace ${slug} not found - re-list workspaces`);

Type guard

function isAbortPayload(d) { return d?.type === 'abort' && typeof d.error === 'string'; }

Try / catch

try { const d = await threadChat(...); if (isAbortPayload(d)) throw new Error(d.error); }
catch (e) { if (/not found/.test(e.message)) await refreshWorkspaceCache(); throw e; }

Prevention

When it happens

Trigger: Chatting to a thread under a non-existent workspace slug; deleted workspace; workspace name or UUID used in place of slug.

Common situations: Client state holds slugs from before a workspace purge; scripts promoted between environments without updating slugs.

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@3aec848f28 (2026-08-18). Data as JSON: /api/errors/94a24424d3f9d0b3. Report an issue: GitHub.