Mintplex-Labs/anything-llm · warning

Workspace not found

Error message

Workspace not found

What it means

HTTP 404 from POST /api/v1/workspace/:slug/thread/:threadSlug/update when Workspace.get({slug}) returns null. Update requests resolve the parent workspace first; an unknown workspace slug fails before the thread is even looked up. Body may carry {name} for the new thread name.

Source

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

                },
                message: null,
              }
            }
          }
        }
      }
      #swagger.responses[403] = {
        schema: {
          "$ref": "#/definitions/InvalidAPIKey"
        }
      }
      */
      try {
        const { slug, threadSlug } = request.params;
        const { name } = reqBody(request);
        const workspace = await Workspace.get({ slug: String(slug) });
        if (!workspace) {
          response.status(404).json({ message: "Workspace not found" });
          return;
        }

        const thread = await WorkspaceThread.get({
          slug: String(threadSlug),
          workspace_id: workspace.id,
        });
        if (!thread) {
          response.status(404).json({ message: "Thread not found" });
          return;
        }

        const { thread: updatedThread, message } = await WorkspaceThread.update(
          thread,
          { name }
        );
        response.status(200).json({ thread: updatedThread, message });
      } catch (e) {

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Verify the workspace slug with GET /api/v1/workspaces
  2. Confirm the full hierarchy with GET /api/v1/workspace/:slug/thread/:threadSlug/chats before updating
  3. Refresh cached slugs after workspace re-creation
  4. Pass the slug field from the API, never the display name

Example fix

// before
await updateThread('my workspace', 'thread-abc', { name: 'New' });
// after
const { slug } = await getWorkspaceByName('my workspace'); // resolves real slug
await updateThread(slug, 'thread-abc', { name: 'New' });
Defensive patterns

Strategy: validation

Validate before calling

const ws = await fetch(`${BASE}/api/v1/workspace/${slug}`, { headers: AUTH });
if (ws.status === 404 || ws.status === 400) throw new Error('resolve workspace slug first');

Type guard

const isSlugPair = (p) => isWorkspaceSlug(p.slug) && isWorkspaceSlug(p.threadSlug);

Prevention

When it happens

Trigger: Calling thread update with a workspace slug that does not exist (typo, deleted workspace, name used instead of slug); correct thread slug but wrong parent workspace.

Common situations: Workspace was deleted leaving orphaned thread references in client state; slug copied from a different environment; renaming workspaces and assuming slugs follow.

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