{"record":{"id":"3b33747eb8e35c4e","repo":"danny-avila/LibreChat","slug":"unsupported-file-type","errorCode":null,"errorMessage":"Unsupported file type","messagePattern":"Unsupported file type","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"api/server/services/Files/process.js","lineNumber":1365,"sourceCode":"  });\n  const fileSizeLimit =\n    isAvatar === true ? fileConfig.avatarSizeLimit : endpointFileConfig.fileSizeLimit;\n\n  if (file.size > fileSizeLimit) {\n    throw new Error(\n      `File size limit of ${fileSizeLimit / megabyte} MB exceeded for ${\n        isAvatar ? 'avatar upload' : `${endpoint} endpoint`\n      }`,\n    );\n  }\n\n  const isSupportedMimeType = fileConfig.checkType(\n    file.mimetype,\n    endpointFileConfig.supportedMimeTypes,\n  );\n\n  if (!isSupportedMimeType) {\n    throw new Error('Unsupported file type');\n  }\n\n  if (!image || isAvatar === true) {\n    return;\n  }\n\n  if (!width) {\n    throw new Error('No width provided');\n  }\n\n  if (!height) {\n    throw new Error('No height provided');\n  }\n}\n\nmodule.exports = {\n  filterFile,\n  processFileURL,","sourceCodeStart":1347,"sourceCodeEnd":1383,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/process.js#L1347-L1383","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// librechat.yaml before\nfileConfig:\n  supportedMimeTypes:\n    - image/jpeg\n    - image/png\n// after\nfileConfig:\n  supportedMimeTypes:\n    - image/jpeg\n    - image/png\n    - image/webp","handlingStrategy":"validation","validationCode":"function isSupportedMime(file, supported) {\n  return supported.includes(file.type);\n}","typeGuard":"const hasSupportedMime = (file, supported) => supported.includes(file?.type);","tryCatchPattern":null,"preventionTips":["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."],"tags":["files","validation","config","mimetype"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}