immich-app/immich · error · NotFoundException

Asset media not found

Error message

Asset media not found

What it means

Thrown by AssetMediaService when resolving a thumbnail/preview path: after all downgrades (original-for-web-images, fullsize→preview fallback) the resolved `path` is still empty, so no rendition exists to serve. NotFoundException (HTTP 404). Typically the asset exists and the caller has access, but the preview/thumbnail generation job has not produced output (or was disabled).

Source

Thrown at server/src/services/asset-media.service.ts:285

    const { originalPath, originalFileName, path } = await this.assetRepository.getForThumbnail(
      id,
      size,
      dto.edited ?? false,
    );

    if (size === AssetFileType.FullSize && mimeTypes.isWebSupportedImage(originalPath) && !dto.edited) {
      // use original file for web supported images
      return { targetSize: 'original' };
    }

    if (dto.size === AssetMediaSize.FULLSIZE && !path) {
      // downgrade to preview if fullsize is not available.
      // e.g. disabled or not yet (re)generated
      return { targetSize: AssetMediaSize.PREVIEW };
    }

    if (!path) {
      throw new NotFoundException('Asset media not found');
    }

    const fileNameBase =
      auth.sharedLink && !auth.sharedLink.showExif ? id : getFileNameWithoutExtension(originalFileName);
    const fileName = `${fileNameBase}_${size}${getFilenameExtension(path)}`;

    return new ImmichFileResponse({
      fileName,
      path,
      contentType: mimeTypes.lookup(path),
      cacheControl: CacheControl.PrivateWithCache,
    });
  }

  async playbackVideo(auth: AuthDto, id: string): Promise<ImmichFileResponse> {
    await this.requireAccess({ auth, permission: Permission.AssetView, ids: [id] });

    const asset = await this.assetRepository.getForVideo(id);

View on GitHub (pinned to 199723261c)

Solutions

  1. Wait for / retry after the preview and thumbnail generation jobs finish for the asset
  2. Confirm the job queue (newsletter/thumbnail/preview workers) is running and not backed up
  3. Check System Settings → Image/Job configuration to ensure preview/thumbnail generation is enabled
  4. Trigger regeneration for the asset if jobs are stuck
Defensive patterns

Strategy: retry

Validate before calling

// Check job status / wait for renditions before requesting thumbnails
// (No direct 'has preview' API — retry with backoff is the practical pattern.)

Try / catch

async function getThumbnail(id, attempt = 0) {
  try {
    return await sdk.viewThumbnail(id, { size: 'preview' });
  } catch (e) {
    if (e instanceof HttpError && e.status === 404 && attempt < 5) {
      await new Promise(r => setTimeout(r, 1000 * 2 ** attempt)); // backoff
      return getThumbnail(id, attempt + 1);
    }
    throw e;
  }
}

Prevention

When it happens

Trigger: GET /assets/:id/thumbnail or preview for an asset whose preview JPEG was never generated — job queue stalled, preview generation disabled in system config, or the asset is brand new and jobs haven't run yet.

Common situations: Freshly uploaded assets queried before the thumbnail/preview jobs complete; storage failures during generation; machine-learning/storage job workers offline; preview config toggled off after ingest.

Related errors


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