remotion-dev/remotion · warning · Error

Unexpected response from server: ${JSON.stringify(json)}

Error message

Unexpected response from server: ${JSON.stringify(json)}

What it means

Defensive throw in internalRegisterUsageEvent for an unexpected contract violation: the server returned success:false but res.ok was true (HTTP 2xx). This should never happen against the real licensing API; it indicates a malformed/intercepted response, a man-in-the-middle (e.g. a proxy returning HTML), or a version skew between client and server.

Source

Thrown at packages/licensing/src/register-usage-event.ts:125

				},
				signal: abortController.signal,
			});
			clearTimeout(timeout);

			const json = (await res.json()) as ApiResponse;

			if (json.success) {
				return {
					billable: json.billable,
					classification: json.classification,
				};
			}

			if (!res.ok) {
				throw new Error(json.error);
			}

			throw new Error(
				`Unexpected response from server: ${JSON.stringify(json)}`,
			);
		} catch (err) {
			clearTimeout(timeout);

			const error = err as Error;
			const isTimeout = error.name === 'AbortError';
			const isRetryable = isNetworkError(error) || isTimeout;

			if (!isRetryable) {
				throw err;
			}

			lastError = isTimeout
				? new Error('Request timed out after 10 seconds')
				: error;

			if (attempt < totalAttempts) {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Log the full json payload to see what the server actually returned.
  2. Bypass any HTTP proxies intercepting requests to remotion.pro and retry.
  3. Upgrade @remotion/licensing to match the rest of the Remotion packages.
  4. If using a custom HOST, ensure the endpoint implements the documented response shape.

Example fix

// before
fetch behind corporate proxy -> 200 with HTML body
// after
export HTTPS_PROXY='' && re-run; or upgrade @remotion/licensing to the installed Remotion version
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: ensure responses are JSON-shaped
const probe = await fetch('https://www.remotion.pro/api/track/health');
if (!probe.headers.get('content-type')?.includes('application/json')) {
  console.warn('Proxy may be intercepting remotion.pro traffic');
}

Type guard

const isApiResponse = (j: unknown): boolean =>
  typeof j === 'object' && j !== null && 'success' in j;

Try / catch

try {
  await internalRegisterUsageEvent({...});
} catch (e) {
  if (/Unexpected response from server/i.test((e as Error).message)) {
    // Likely a proxy interception; log full body for ops
    console.error('Licensing API contract violation:', (e as Error).message);
  } else throw e;
}

Prevention

When it happens

Trigger: A corporate proxy or CDN intercepting the request and returning a 200 with a non-conforming JSON body; calling a mock/staging endpoint that does not implement the success:false contract; a future API change returning a new shape this client version does not understand.

Common situations: Behind a captive portal or Zscaler/ Netskope proxy that returns 200 + HTML; the licensing HOST was monkey-patched to a test server; an outdated @remotion/licensing version against a newer backend.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/4a2d07d2011d0164. Report an issue: GitHub.