RocketChat/Rocket.Chat · error · Error

FileUpload_Error

Error message

FileUpload_Error

What it means

The fallback error in useEndpointUploadMutation: the upload failed (success === false) but neither result.status nor result.error is a usable string, so the hook throws the localized generic message t('FileUpload_Error'). This is the catch-all so the user always sees a translated toast rather than a blank or English-only default.

Source

Thrown at apps/meteor/client/hooks/useEndpointUploadMutation.ts:30

	const sendData = useUpload(endpoint as PathFor<'POST'>);
	const dispatchToastMessage = useToastMessageDispatch();

	return useMutation({
		mutationFn: async (formData: FormData): Promise<TData> => {
			const data = sendData(formData);
			const promise = data instanceof Promise ? data : data.promise;
			const result = await promise;

			if (!result.success) {
				if (result.status) {
					throw new Error(result.status);
				}

				if (typeof result.error === 'string') {
					throw new Error(result.error);
				}

				throw new Error(t('FileUpload_Error'));
			}
			return result as TData;
		},
		onError: (error) => {
			dispatchToastMessage({ type: 'error', message: error });
		},
		...options,
	});
};

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Reproduce with the browser DevTools Network tab open and inspect the raw response body — the lack of status/error is the real defect.
  2. Check the server logs for the upload handler's exception; the client cannot tell you more because the server sent no reason.
  3. Ensure any apps-engine upload interceptor populates both `status` and `error` on failure so users get an actionable message.
  4. If using a reverse proxy, confirm it does not truncate the JSON body for non-2xx-mapped 200 responses.
  5. As a last resort, retry the upload; transient infrastructure issues can produce empty failure bodies.
Defensive patterns

Strategy: fallback

Type guard

function isBareFailedUploadResult(r: UploadResult): boolean {
  return !r.success && !r.status && typeof (r as any).error !== 'string';
}

Try / catch

try {
  await upload.mutateAsync(formData);
} catch (e) {
  if ((e as Error).message === t('FileUpload_Error')) {
    // generic fallback — inspect network response for the real cause
    console.error('Upload failed with no server reason');
  }
}

Prevention

When it happens

Trigger: result.success === false AND result.status is falsy AND (result.error is not a string or is undefined). The server returned an UploadResult with success:false but no structured reason — e.g. an empty 200 body, or a body like { success: false }.

Common situations: Server bug returning success:false with no reason; network proxy/gateway stripping the response body; an apps-engine interceptor that resolves { success: false } without populating fields; a half-failed chunked upload where the final assembly returns a bare failure.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/2c21a82813e96649. Report an issue: GitHub.