Mintplex-Labs/anything-llm · error

Workspace ID is required

Error message

Workspace ID is required

What it means

Input validation in handleMobileCommand() for the 'stream-chat' command: the request body omits workspaceSlug, so no workspace can be resolved to stream a chat into. The endpoint returns HTTP 400 with this message instead of proceeding.

Source

Thrown at server/endpoints/mobile/utils/index.js:148

    return response.status(200).json({ success: true });
  }

  if (command === "new-thread") {
    const { workspaceSlug } = body;
    const workspace = user
      ? await Workspace.getWithUser(user, { slug: String(workspaceSlug) })
      : await Workspace.get({ slug: String(workspaceSlug) });

    if (!workspace)
      return response.status(400).json({ error: "Workspace not found" });
    const { thread } = await WorkspaceThread.new(workspace, user?.id);
    return response.status(200).json({ thread });
  }

  if (command === "stream-chat") {
    const { workspaceSlug = null, threadSlug = null, message } = body;
    if (!workspaceSlug)
      return response.status(400).json({ error: "Workspace ID is required" });
    else if (!message)
      return response.status(400).json({ error: "Message is required" });

    const workspace = user
      ? await Workspace.getWithUser(user, { slug: String(workspaceSlug) })
      : await Workspace.get({ slug: String(workspaceSlug) });

    if (!workspace)
      return response.status(400).json({ error: "Workspace not found" });
    const thread = threadSlug
      ? await prisma.workspace_threads.findFirst({
          where: {
            workspace_id: workspace.id,
            slug: String(threadSlug),
            ...(user ? { user_id: user.id } : {}),
          },
        })
      : null;

View on GitHub (pinned to 20f6d3546c)

Solutions

  1. Include the workspace ID in the request payload.
  2. Fetch the workspace list to obtain a valid ID.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/endpoints/mobile/utils/index.js:144 when the library encounters an invalid state.

Common situations: A mobile API call was made without the required workspace ID.


AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18). Data as JSON: /api/errors/7615a8b04e7287f3. Report an issue: GitHub.