danny-avila/LibreChat · error · Error
Unsupported file type
Error message
Unsupported file type
What it means
filterFile() throws this at process.js:1365 when fileConfig.checkType returns false for the uploaded file's mimetype against endpointFileConfig.supportedMimeTypes. The supported list is derived from librechat.yaml fileConfig.supportedMimeTypes (per-endpoint) or the framework default. It is the MIME gate that runs after the size check.
Source
Thrown at api/server/services/Files/process.js:1365
});
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;
}
if (!width) {
throw new Error('No width provided');
}
if (!height) {
throw new Error('No height provided');
}
}
module.exports = {
filterFile,
processFileURL,View on GitHub (pinned to 5ff282f900)
Solutions
- Convert the file to a supported type (e.g. PNG/JPEG for images) before uploading.
- Add the required mimetype to fileConfig.supportedMimeTypes in librechat.yaml for that endpoint.
- Ensure the uploaded file extension matches its real content so multer infers the correct mimetype.
Example fix
// librechat.yaml before
fileConfig:
supportedMimeTypes:
- image/jpeg
- image/png
// after
fileConfig:
supportedMimeTypes:
- image/jpeg
- image/png
- image/webp Defensive patterns
Strategy: validation
Validate before calling
function isSupportedMime(file, supported) {
return supported.includes(file.type);
} Type guard
const hasSupportedMime = (file, supported) => supported.includes(file?.type);
Prevention
- Fetch the supported MIME list from config and filter the file picker accept attribute.
- Detect real content type client-side for ambiguous extensions before uploading.
When it happens
Trigger: Uploading a file whose Content-Type / detected mimetype is not in the endpoint's supportedMimeTypes list, e.g. a .heic image on an endpoint that only allows image/jpeg, image/png. A .docx on a code-only endpoint. The check uses the multer-reported mimetype, which is inferred from extension/headers.
Common situations: User uploads a modern format (avif, webp, heic) not in the default list. A misnamed extension causes multer to infer the wrong mimetype. An admin tightened supportedMimeTypes and users still send legacy formats.
Related errors
- No endpoint provided
- File size limit of ${fileSizeLimit / megabyte} MB exceeded f
- No file_id provided
- Empty file uploaded
- No width provided
AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12).
Data as JSON: /api/errors/3b33747eb8e35c4e.
Report an issue: GitHub.