immich-app/immich · warning · BadRequestException

Asset dimensions are not available for editing

Error message

Asset dimensions are not available for editing

What it means

Thrown by editAsset at the unconditional dimension gate (line 558-559). getDimensions(asset) derives width/height from the asset's exifImage/encoded data; if both are absent or zero, the editor cannot compute crop bounds or preserve aspect ratio, so it rejects ANY edit (rotate/mirror included) with 400 BadRequest. This check runs for every edit request, not only crops.

Source

Thrown at server/src/services/asset.service.ts:559

    }

    if (isPanorama(asset)) {
      throw new BadRequestException('Editing panorama images is not supported');
    }

    if (asset.originalPath?.toLowerCase().endsWith('.gif')) {
      throw new BadRequestException('Editing GIF images is not supported');
    }

    if (asset.originalPath?.toLowerCase().endsWith('.svg')) {
      throw new BadRequestException('Editing SVG images is not supported');
    }

    // check that crop parameters will not go out of bounds
    const { width: assetWidth, height: assetHeight } = getDimensions(asset);

    if (!assetWidth || !assetHeight) {
      throw new BadRequestException('Asset dimensions are not available for editing');
    }

    const edits = dto.edits as AssetEditActionItem[];
    const crop = edits.find((e) => e.action === AssetEditAction.Crop);
    if (crop) {
      if (edits[0].action !== AssetEditAction.Crop) {
        throw new BadRequestException('Crop action must be the first edit action');
      }

      // check that crop parameters will not go out of bounds
      const { width: assetWidth, height: assetHeight } = getDimensions(asset);

      if (!assetWidth || !assetHeight) {
        throw new BadRequestException('Asset dimensions are not available for editing');
      }

      const { x, y, width, height } = crop.parameters;
      if (x + width > assetWidth || y + height > assetHeight) {

View on GitHub (pinned to 199723261c)

Solutions

  1. Wait for the asset's metadata job to finish (asset.exifInfo has width/height) before enabling edit.
  2. In the UI, disable the editor until asset.exifInfo?.width and height are present.
  3. Re-run metadata extraction for the asset if dimensions remain missing.

Example fix

// before
if (asset.type === 'IMAGE') openEditor(asset);

// after
const hasDims = !!asset.exifInfo?.width && !!asset.exifInfo?.height;
if (asset.type === 'IMAGE' && hasDims) openEditor(asset);
else notify('Asset is still being processed; try again shortly.');
Defensive patterns

Strategy: validation

Validate before calling

// Require populated dimensions before allowing any edit.
const w = asset.exifInfo?.width ?? asset.width;
const h = asset.exifInfo?.height ?? asset.height;
if (!w || !h) {
  throw new Error('Asset dimensions not ready; wait for metadata extraction.');
}
await api.put(`/assets/${asset.id}/edits`, { edits });

Type guard

function hasDimensions(a: any): boolean {
  const w = a?.exifInfo?.width ?? a?.width;
  const h = a?.exifInfo?.height ?? a?.height;
  return Number.isFinite(w) && w > 0 && Number.isFinite(h) && h > 0;
}

Prevention

When it happens

Trigger: PUT /assets/:id/edits on an asset whose width and height are not yet populated (metadata/video-metadata extraction not finished, or extraction failed and left nulls).

Common situations: Editing immediately after upload before the metadata job runs; assets whose EXIF has no dimensions and transcoding has not populated them; corrupted upload that never got probed.

Related errors


AI-assisted analysis of immich-app/immich@199723261c (2026-08-12). Data as JSON: /api/errors/2011ac64359b2a84. Report an issue: GitHub.