{"record":{"id":"e130e9a8d3e0accd","repo":"immich-app/immich","slug":"skipping-thumbnail-generation-for-asset-id-asset-type-is-not","errorCode":null,"errorMessage":"Skipping thumbnail generation for asset ${id}: ${asset.type} is not an image or video","messagePattern":"Skipping thumbnail generation for asset (.+?): (.+?) is not an image or video","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/services/media.service.ts","lineNumber":216,"sourceCode":"    if (!asset) {\n      this.logger.warn(`Thumbnail generation failed for asset ${id}: not found in database or missing metadata`);\n      return JobStatus.Failed;\n    }\n\n    if (asset.visibility === AssetVisibility.Hidden) {\n      this.logger.verbose(`Thumbnail generation skipped for asset ${id}: not visible`);\n      return JobStatus.Skipped;\n    }\n\n    let generated: Awaited<ReturnType<MediaService['generateImageThumbnails']>>;\n    if (asset.type === AssetType.Video || asset.originalFileName.toLowerCase().endsWith('.gif')) {\n      this.logger.verbose(`Thumbnail generation for video ${id} ${asset.originalPath}`);\n      generated = await this.generateVideoThumbnails(asset, config);\n    } else if (asset.type === AssetType.Image) {\n      this.logger.verbose(`Thumbnail generation for image ${id} ${asset.originalPath}`);\n      generated = await this.generateImageThumbnails(asset, config);\n    } else {\n      this.logger.warn(`Skipping thumbnail generation for asset ${id}: ${asset.type} is not an image or video`);\n      return JobStatus.Skipped;\n    }\n\n    const editedGenerated = await this.generateEditedThumbnails(asset, config);\n    if (editedGenerated) {\n      generated.files.push(...editedGenerated.files);\n    }\n\n    await this.syncFiles(asset.files, generated.files);\n    const thumbhash = editedGenerated?.thumbhash || generated.thumbhash;\n\n    if (!asset.thumbhash || Buffer.compare(asset.thumbhash, thumbhash) !== 0) {\n      await this.assetRepository.update({ id: asset.id, thumbhash });\n    }\n\n    return JobStatus.Success;\n  }\n","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/immich-app/immich/blob/e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c/server/src/services/media.service.ts#L198-L234","documentation":"Thumbnail generation only supports AssetType.Video and AssetType.Image. If the asset's type enum holds any other value (or an unexpected type string), the handler logs this warning and returns JobStatus.Skipped rather than throwing on an unhandled media kind.","triggerScenarios":"handleGenerateThumbnails receives an asset whose asset.type is neither Video nor Image — typically a malformed type value in the database or a newly introduced type not yet handled by the media service.","commonSituations":"Manually edited or migrated database rows with unexpected type values; uploads whose type detection misclassified the file; running an older server against a database written by a newer version that added a type.","solutions":["Inspect the row: SELECT type FROM asset WHERE id = '<id>'; and correct it to IMAGE or VIDEO if wrong","Re-upload the asset if type detection corrupted it","Re-run metadata extraction to re-derive the asset type","Update the server to a version that handles the asset type in question"],"exampleFix":"// before\n} else { this.logger.warn(`Skipping thumbnail generation for asset ${id}: ${asset.type} is not an image or video`); return JobStatus.Skipped; }\n// after\n} else { this.logger.warn(`Skipping thumbnail generation for asset ${id}: ${asset.type} is not an image or video`); await this.assetRepository.update({ id, type: await detectType(asset.originalPath) }); return JobStatus.Failed; }","handlingStrategy":"type-guard","validationCode":"if (asset.type !== AssetType.Image && asset.type !== AssetType.Video) {\n  // re-run metadata extraction or flag the asset for review\n}","typeGuard":"function isThumbnailable(t: AssetType): boolean { return t === AssetType.Image || t === AssetType.Video; }","tryCatchPattern":"if (!isThumbnailable(asset.type)) { this.logger.warn(`Skipping thumbnail generation for asset ${id}: ${asset.type}`); return JobStatus.Skipped; }","preventionTips":["Never hand-edit asset.type values in the database","Re-run metadata extraction if type detection looks wrong","Keep server and DB schema versions in sync","Validate uploaded files produce a known asset type"],"tags":["thumbnails","asset-type","enum"],"backgroundTag":"unsupported-enum-value","analyzedSha":"e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c","analyzedAt":"2026-09-15T07:20:19.675Z","contentChangedAt":"2026-09-15T07:20:19.675Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}