{"record":{"id":"852105c050b0ea48","repo":"danny-avila/LibreChat","slug":"no-height-provided","errorCode":null,"errorMessage":"No height provided","messagePattern":"No height provided","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"api/server/services/Files/process.js","lineNumber":1377,"sourceCode":"  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,\n  saveBase64Image,\n  processImageFile,\n  uploadImageBuffer,\n  sweepExpiredFiles,\n  startExpiredFileSweep,\n  processFileUpload,\n  processDeleteRequest,\n  processAgentFileUpload,\n  retrieveAndProcessFile,\n};\n","sourceCodeStart":1359,"sourceCodeEnd":1394,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/process.js#L1359-L1394","documentation":"filterFile() throws this at process.js:1377 when image is true, the upload is not an avatar, and req.body.height is falsy. Identical rationale to the width check (1373): height is recorded on the file and used by the image pipeline. Reached only when width already passed, so a missing height on an otherwise complete image upload is the trigger.","triggerScenarios":"POST /api/files/images whose body omits height, sends height:0, or sends it under a wrong key. Fires immediately after the width check succeeds.","commonSituations":"Client builds FormData in a branch that sets width but skips height. Image with height 0 due to a failed dimension read. Copy/paste from a sample that only included width.","solutions":["Append a positive integer height alongside width to the upload body.","Use a single helper that sets both dimensions from naturalWidth/naturalHeight together.","Guard the FormData construction so width and height are set atomically."],"exampleFix":"// before\nform.append('width', String(w));\n// after\nform.append('width', String(w));\nform.append('height', String(h));","handlingStrategy":"validation","validationCode":"function withImageDims(form, width, height) {\n  if (!(width > 0) || !(height > 0)) throw new Error('image dims required');\n  form.append('width', String(width));\n  form.append('height', String(height));\n  return form;\n}","typeGuard":"const hasPositiveHeight = (body) => Number.isFinite(+body?.height) && +body.height > 0;","tryCatchPattern":null,"preventionTips":["Always append width and height in the same code block.","Unit-test the FormData builder to assert both fields are present."],"tags":["files","validation","images","upload"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}