RocketChat/Rocket.Chat · error · CloudWorkspaceAccessTokenEmptyError
Workspace access token is empty
Error message
Workspace access token is empty
What it means
Thrown by syncCloudData() when the workspace reports as registered with Rocket.Chat Cloud but getWorkspaceAccessToken(true) resolves to an empty string. getWorkspaceAccessToken returns '' when an offline license is active or when fetching a new token from Cloud fails in its non-throwing mode, so the sync run has no bearer token and aborts before building the registration payload.
Source
Thrown at apps/meteor/server/lib/cloud/syncWorkspace/syncCloudData.ts:22
import { fetchWorkspaceSyncPayload } from './fetchWorkspaceSyncPayload';
import { CloudWorkspaceAccessError } from '../../../../lib/errors/CloudWorkspaceAccessError';
import { CloudWorkspaceRegistrationError } from '../../../../lib/errors/CloudWorkspaceRegistrationError';
import { callbacks } from '../../callbacks';
import { SystemLogger } from '../../logger/system';
import { buildWorkspaceRegistrationData } from '../buildRegistrationData';
import { CloudWorkspaceAccessTokenEmptyError, getWorkspaceAccessToken } from '../getWorkspaceAccessToken';
import { retrieveRegistrationStatus } from '../retrieveRegistrationStatus';
export async function syncCloudData() {
try {
const { workspaceRegistered } = await retrieveRegistrationStatus();
if (!workspaceRegistered) {
throw new CloudWorkspaceRegistrationError('Workspace is not registered');
}
const token = await getWorkspaceAccessToken(true);
if (!token) {
throw new CloudWorkspaceAccessTokenEmptyError();
}
const workspaceRegistrationData = await buildWorkspaceRegistrationData(undefined);
const {
license,
removeLicense = false,
cloudSyncAnnouncement,
} = await fetchWorkspaceSyncPayload({
token,
data: workspaceRegistrationData,
});
await Settings.updateValueById('Cloud_Sync_Announcement_Payload', JSON.stringify(cloudSyncAnnouncement ?? null));
if (removeLicense) {
await callbacks.run('workspaceLicenseRemoved');
} else {View on GitHub (pinned to b2c16d5842)
Solutions
- If an offline license is intentional, remove the stale cloud registration data so retrieveRegistrationStatus no longer reports registered
- Verify outbound HTTPS connectivity to Rocket.Chat Cloud from the server, then let the sync retry and fetch a fresh token
- Re-register the workspace (Administration > Connectivity Services) so valid WorkspaceCredentials are stored
- Check the WorkspaceCredentials collection and server logs for silent token-fetch failures if the issue persists
Example fix
// before
const token = await getWorkspaceAccessToken(true);
if (!token) {
throw new CloudWorkspaceAccessTokenEmptyError();
}
// after: only sync when a token is actually obtainable, otherwise surface re-registration
const token = await getWorkspaceAccessToken(true);
if (!token) {
await updateRegistrationStatus();
return; // skip this sync cycle instead of throwing Defensive patterns
Strategy: validation
Validate before calling
import { getWorkspaceAccessToken } from './getWorkspaceAccessToken';
import { retrieveRegistrationStatus } from './retrieveRegistrationStatus';
const { workspaceRegistered } = await retrieveRegistrationStatus();
const token = await getWorkspaceAccessToken(true);
if (workspaceRegistered && !token) {
// skip the sync cycle and surface a re-registration prompt instead of throwing
} Try / catch
try {
await syncCloudData();
} catch (err) {
if (err instanceof CloudWorkspaceAccessTokenEmptyError) {
// token unobtainable: schedule re-registration, do not retry blindly
return;
}
throw err;
} Prevention
- Complete the full Cloud registration/login flow so WorkspaceCredentials persist
- Keep server egress to Cloud open so token renewal never silently fails
- If running under an offline license, clear leftover cloud registration data
When it happens
Trigger: The periodic workspace sync (or a manual sync call) runs when retrieveRegistrationStatus() says registered, but the WorkspaceCredentials cache is empty/expired and the token request to Cloud fails silently, or License.hasOfflineLicense() makes getWorkspaceAccessToken return '' unconditionally.
Common situations: Offline license installed on a workspace that still carries cloud registration data; Cloud unreachable (firewall/DNS) so token renewal never succeeds; registration records partially present after a database restore or migration.
Related errors
- Workspace access token is empty
- Failed to connect to Rocket.Chat Cloud: ${error}
- Invalid registration token
- (await response.json()).error
- Failed to fetch registration intent endpoint
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/c53037261868b1e9.
Report an issue: GitHub.