Mintplex-Labs/anything-llm · error

User is suspended - cannot register device

Error message

User is suspended - cannot register device

What it means

Multi-user registration check: if the user tied to the temp token has suspended = true, validRegistrationToken returns 400 { error: 'User is suspended - cannot register device' } before attaching response.locals.user, so MobileDevice.create is never called for that account.

Source

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

    if (!tempTokenData)
      return response
        .status(400)
        .json({ error: "Invalid or expired registration token" });

    // If in multi-user mode, we need to validate the user id
    // associated exists, is not banned and then associate with locals so we can reuse it later.
    // If not in multi-user mode then simply having a valid token is enough.
    const multiUserMode = await SystemSettings.isMultiUserMode();
    if (multiUserMode) {
      if (!tempTokenData.userId)
        return response
          .status(400)
          .json({ error: "User id not found in registration token" });
      const user = await User.get({ id: Number(tempTokenData.userId) });
      if (!user) return response.status(400).json({ error: "User not found" });
      if (user.suspended)
        return response
          .status(400)
          .json({ error: "User is suspended - cannot register device" });
      response.locals.user = user;
    }

    next();
  } catch (error) {
    console.error("validRegistrationToken:error", error);
    response.status(500).json({
      error: "Invalid middleware response from validRegistrationToken",
    });
  }
}

module.exports = {
  validDeviceToken,
  validRegistrationToken,
};

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Admin unsuspends the account, then restart pairing with fresh connect-info
  2. Or pair the device to an active account instead
  3. Show 'account suspended — contact admin' in the UI and stop the flow; retrying the same token will not help
Defensive patterns

Strategy: fallback

Try / catch

try {
  await register(tempToken);
} catch (e) {
  if (e.status === 400 && e.body?.error?.includes('cannot register device')) {
    return showFatal('Account suspended — pair with an active account or contact admin');
  }
  throw e;
}

Prevention

When it happens

Trigger: A suspended user opens a connect-info/QR generated before suspension (or while suspension was being applied) and attempts to register a device.

Common situations: Suspension landing while the pairing flow was in progress; stale QR codes shared before the account was suspended.

Related errors


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