danny-avila/LibreChat · error · Error

No height provided

Error message

No height provided

What it means

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.

Source

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

  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,
  saveBase64Image,
  processImageFile,
  uploadImageBuffer,
  sweepExpiredFiles,
  startExpiredFileSweep,
  processFileUpload,
  processDeleteRequest,
  processAgentFileUpload,
  retrieveAndProcessFile,
};

View on GitHub (pinned to 5ff282f900)

Solutions

  1. Append a positive integer height alongside width to the upload body.
  2. Use a single helper that sets both dimensions from naturalWidth/naturalHeight together.
  3. Guard the FormData construction so width and height are set atomically.

Example fix

// before
form.append('width', String(w));
// after
form.append('width', String(w));
form.append('height', String(h));
Defensive patterns

Strategy: validation

Validate before calling

function withImageDims(form, width, height) {
  if (!(width > 0) || !(height > 0)) throw new Error('image dims required');
  form.append('width', String(width));
  form.append('height', String(height));
  return form;
}

Type guard

const hasPositiveHeight = (body) => Number.isFinite(+body?.height) && +body.height > 0;

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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