slymnoyann/hey-1 · error · Error
Could not generate thumbnails
Error message
Could not generate thumbnails
What it means
Thrown by generateThumbnails in ChooseThumbnail.tsx when the video thumbnail generation pipeline returns an empty array. It wraps generateVideoThumbnails (which decodes the selected video file and extracts THUMBNAIL_GENERATE_COUNT frames); an empty result means zero frames could be extracted from the file.
Source
Thrown at src/components/Composer/ChooseThumbnail.tsx:125
);
} else {
setVideoThumbnail({
...videoThumbnail,
uploading: false,
url: thumbnail.decentralizedUrl
});
}
};
const generateThumbnails = async (fileToGenerate: File) => {
try {
setIsGenerating(true);
const thumbnailArray = await generateVideoThumbnails(
fileToGenerate,
THUMBNAIL_GENERATE_COUNT
);
if (!thumbnailArray.length) {
throw new Error("Could not generate thumbnails");
}
const thumbnailList: Thumbnail[] = [];
for (const thumbnailBlob of thumbnailArray) {
thumbnailList.push({ blobUrl: thumbnailBlob, decentralizedUrl: "" });
}
setThumbnailList(thumbnailList);
handleSelectThumbnail(DEFAULT_THUMBNAIL_INDEX, thumbnailList);
} catch {
setThumbnailList([]);
setVideoThumbnail(DEFAULT_VIDEO_THUMBNAIL);
toast.error("Failed to generate video thumbnails");
} finally {
setIsGenerating(false);
}
};
useEffect(() => {View on GitHub (pinned to 88c8f9d553)
Solutions
- Verify the video file plays in an <video> element in the same browser before generating thumbnails; if it doesn't, reject the file at selection time with a codec error
- Check file.size > 0 and file.type starts with 'video/' before calling generateThumbnails
- If codecs are the issue, require transcoding to H.264/MP4 (or WebM) before upload
- Catch this error in the UI and prompt the user to pick a different file or retry
Example fix
// before
const thumbnailArray = await generateVideoThumbnails(fileToGenerate, THUMBNAIL_GENERATE_COUNT);
if (!thumbnailArray.length) {
throw new Error("Could not generate thumbnails");
}
// after: validate decodability first
const canDecode = await new Promise((resolve) => {
const v = document.createElement("video");
v.preload = "metadata";
v.onloadedmetadata = () => resolve(Number.isFinite(v.duration) && v.duration > 0);
v.onerror = () => resolve(false);
v.src = URL.createObjectURL(fileToGenerate);
});
if (!canDecode) {
throw new Error("Video format not supported by your browser");
}
const thumbnailArray = await generateVideoThumbnails(fileToGenerate, THUMBNAIL_GENERATE_COUNT);
if (!thumbnailArray.length) {
throw new Error("Could not generate thumbnails");
} Defensive patterns
Strategy: validation
Validate before calling
const canExtractFrames = async (file: File) => {
if (!file.type.startsWith("video/") || file.size === 0) return false;
return new Promise((resolve) => {
const v = document.createElement("video");
v.preload = "metadata";
v.onloadedmetadata = () => resolve(Number.isFinite(v.duration) && v.duration > 0);
v.onerror = () => resolve(false);
v.src = URL.createObjectURL(file);
});
}; Type guard
const isDecodableVideo = (file: File): boolean => file.size > 0 && /^video\//.test(file.type);
Try / catch
try {
await generateThumbnails(file);
} catch (e) {
if (e instanceof Error && e.message === "Could not generate thumbnails") {
// prompt user: file may use an unsupported codec; suggest MP4/H.264
}
throw e;
} Prevention
- Validate file.type is video/* and size > 0 at file-pick time
- Pre-check the file loads in a video element with a finite duration before generating thumbnails
- Recommend/require H.264 MP4 or WebM outputs from any client-side recording pipeline
When it happens
Trigger: Selecting a video file that the browser cannot decode via the video element (unsupported codec/container), a 0-byte or corrupted video, a file with no video track (audio-only), or metadata loaded but seek/frame capture failing (e.g. duration NaN) so generateVideoThumbnails resolves with [].
Common situations: Users upload HEVC/AVI/MKV files that Chrome/Firefox can't play; a truncated upload or aborted recorder blob; browsers with restrictive codec support (Safari vs Chromium differences); very large files where decoding times out before frames are captured.
Related errors
AI-assisted analysis of slymnoyann/hey-1@88c8f9d553 (2026-08-28).
Data as JSON: /api/errors/f175c763df124c0c.
Report an issue: GitHub.