Mintplex-Labs/anything-llm · error

No workspace found or could be created.

Error message

No workspace found or could be created.

What it means

Returned by POST /telegram/connect when no default workspace slug could be resolved. The endpoint first checks for any existing workspace (Workspace.where({}, 1)); if none exists it tries to create one named '<bot_username> Workspace'. If both the lookup is empty and Workspace.new() yields no workspace, the Telegram connector cannot be bound to a workspace and the request fails with 400.

Source

Thrown at server/endpoints/telegram.js:115

        }

        let workspaceSlug = null;
        if (default_workspace) workspaceSlug = String(default_workspace);
        else {
          const workspaces = await Workspace.where({}, 1);
          if (workspaces.length) workspaceSlug = workspaces[0].slug;
          else {
            const { workspace } = await Workspace.new(
              `${verification.username} Workspace`,
              null,
              { chatMode: "automatic" }
            );
            if (workspace) workspaceSlug = workspace.slug;
          }
        }

        if (!workspaceSlug) {
          return response.status(400).json({
            success: false,
            error: "No workspace found or could be created.",
          });
        }

        // Preserve approved users when reconnecting with a new token
        const existing = await ExternalCommunicationConnector.get("telegram");
        const storedConfig = {
          bot_username: verification.username,
          default_workspace: workspaceSlug,
          approved_users: existing?.config?.approved_users || [],
          voice_response_mode:
            existing?.config?.voice_response_mode || "text_only",
        };

        // Save config with encrypted token
        const { error } = await ExternalCommunicationConnector.upsert(
          "telegram",

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Create a workspace first via the UI or POST /api/workspace, then retry POST /telegram/connect - the endpoint will pick workspaces[0].slug automatically.
  2. If workspace creation persistently fails, inspect server logs around Workspace.new and check the database file/directory permissions and disk space.
  3. As a workaround, pass default_workspace explicitly in the connect request body to target a known-good workspace slug.
Defensive patterns

Strategy: validation

Validate before calling

// Before connecting Telegram, guarantee a workspace exists
const res = await fetch("/api/workspace", { method: "POST", headers, body: JSON.stringify({ name: "Default" }) });
// then POST /telegram/connect with { default_workspace: "<created slug>" } to skip implicit resolution entirely.

Prevention

When it happens

Trigger: Connecting Telegram on a fresh or wiped instance where the default workspace was deleted and every other workspace is gone, while the implicit Workspace.new() also fails (database write error, locked SQLite file, invalid slug generated from the bot username, disk full).

Common situations: Single-user instance after the user deleted all workspaces; corrupted or read-only storage folder (anythingllm.db permissions); first-run where workspace bootstrap failed earlier; bot username containing characters that break slug creation.

Related errors


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