Mintplex-Labs/anything-llm · error

User is suspended.

Error message

User is suspended.

What it means

After token and approval checks pass, validDeviceToken loads the device's owning user (MobileDevice.get with { user: true }); if that user has suspended = true it responds 400 { error: 'User is suspended.' } and never attaches the user to response.locals. A suspended owner blocks the device even when the device itself is approved.

Source

Thrown at server/endpoints/mobile/middleware/index.js:31

  try {
    const token = request.header("x-anythingllm-mobile-device-token");
    if (!token)
      return response.status(400).json({ error: "Device token is required" });

    const device = await MobileDevice.get(
      { token: String(token) },
      { user: true }
    );
    if (!device)
      return response.status(400).json({ error: "Device not found" });
    if (!device.approved)
      return response.status(400).json({ error: "Device not approved" });

    // If the device is associated with a user then we can associate it with the locals
    // so we can reuse it later.
    if (device.user) {
      if (device.user.suspended)
        return response.status(400).json({ error: "User is suspended." });
      response.locals.user = device.user;
    }

    delete device.user;
    response.locals.device = device;
    next();
  } catch (error) {
    console.error("validDeviceToken", error);
    response.status(500).json({ error: "Invalid middleware response" });
  }
}

/**
 * Validates a temporary registration token that is passed in the request
 * and associates the user with the token (if valid). Temporary token is consumed
 * and cannot be used again after this middleware is called.
 * @param {*} request
 * @param {*} response

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Admin must unsuspend the account (multi-user settings) to restore device access
  2. Or pair the device to a different active account via fresh connect-info
  3. On the client, surface 'account suspended — contact admin' and stop retrying
Defensive patterns

Strategy: fallback

Try / catch

try {
  await api.command('workspaces');
} catch (e) {
  if (e.status === 400 && e.body?.error === 'User is suspended.') {
    return showFatal('Account suspended — contact your administrator');
  }
  throw e;
}

Prevention

When it happens

Trigger: Admin suspends the user account that owns the device while the paired app keeps making requests; a device registered under an account that is later suspended.

Common situations: Employee offboarding: account suspended but the phone app still installed and polling; suspension during an active pairing.

Related errors


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