danny-avila/LibreChat · error · Error

File size limit of ${fileSizeLimit / megabyte} MB exceeded f

Error message

File size limit of ${fileSizeLimit / megabyte} MB exceeded for ${isAvatar ? 'avatar upload' : `${endpoint} endpoint`}

What it means

filterFile() throws this at process.js:1352 after computing fileSizeLimit from the merged fileConfig: avatarSizeLimit for avatars, otherwise endpointFileConfig.fileSizeLimit. The limit is bytes; the message renders it as MB (fileSizeLimit / megabyte). This protects against oversized uploads before any disk or remote storage write.

Source

Thrown at api/server/services/Files/process.js:1352

  }

  if (!endpoint && !isAvatar) {
    throw new Error('No endpoint provided');
  }

  const appConfig = req.config;
  const fileConfig = mergeFileConfig(appConfig.fileConfig);

  const endpointFileConfig = getEndpointFileConfig({
    endpoint,
    fileConfig,
    endpointType,
  });
  const fileSizeLimit =
    isAvatar === true ? fileConfig.avatarSizeLimit : endpointFileConfig.fileSizeLimit;

  if (file.size > fileSizeLimit) {
    throw new Error(
      `File size limit of ${fileSizeLimit / megabyte} MB exceeded for ${
        isAvatar ? 'avatar upload' : `${endpoint} endpoint`
      }`,
    );
  }

  const isSupportedMimeType = fileConfig.checkType(
    file.mimetype,
    endpointFileConfig.supportedMimeTypes,
  );

  if (!isSupportedMimeType) {
    throw new Error('Unsupported file type');
  }

  if (!image || isAvatar === true) {
    return;
  }

View on GitHub (pinned to 5ff282f900)

Solutions

  1. Reduce the file size (compress/resize images, trim audio) below the limit shown in the message.
  2. If the limit is wrong, raise fileSizeLimit for that endpoint or avatarSizeLimit in librechat.yaml and restart the API.
  3. Confirm the endpoint you are uploading to is the one whose limit you configured.

Example fix

// librechat.yaml before
fileConfig:
  endpointsSizeLimit: Default,1
// after
fileConfig:
  endpointsSizeLimit: Default,10
Defensive patterns

Strategy: validation

Validate before calling

function withinSizeLimit(file, limitBytes) {
  return file.size <= limitBytes;
}
// before upload:
if (!withinSizeLimit(selectedFile, endpointLimitBytes)) {
  notifyUser(`File exceeds ${endpointLimitBytes / 1e6} MB`);
}

Prevention

When it happens

Trigger: Any upload whose req.file.size exceeds the configured limit for that endpoint or for avatars. Triggered after file_id/endpoint validation and before MIME-type checking, so only correctly-addressed oversize files reach it.

Common situations: librechat.yaml fileConfig endpointsSizeLimit/avatars.sizeLimit set lower than the user's file. A user uploading a 4K screenshot to an endpoint capped at 1 MB. Default limits after an upgrade that tightened them.

Related errors


AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12). Data as JSON: /api/errors/79c8d7317e9ac3a2. Report an issue: GitHub.