remotion-dev/remotion · error · Error
Model ${model} already exists at ${filePath}, but the size i
Error message
Model ${model} already exists at ${filePath}, but the size is ${size} bytes (expected ${modelSizes[model]} bytes). Delete ${filePath} and try again. What it means
Thrown by `downloadWhisperModel` when a file already exists at the resolved model path but its byte size does not match the expected size from `modelSizes`. This indicates a corrupt or partial download (or a wrong file placed manually). Importantly, the throw only happens when `printOutput` is true (the default); with `printOutput: false` the function returns `{alreadyExisted: false}` and re-downloads instead.
Source
Thrown at packages/install-whisper-cpp/src/download-whisper-model.ts:76
throw new Error(
`Invalid whisper model ${model}. Available: ${models.join(', ')}`,
);
}
const filePath = getModelPath(folder, model);
if (existsSync(filePath)) {
const {size} = fs.statSync(filePath);
if (size === modelSizes[model]) {
if (printOutput) {
console.log(`Model already exists at ${filePath}`);
}
return Promise.resolve({alreadyExisted: true});
}
if (printOutput) {
throw new Error(
`Model ${model} already exists at ${filePath}, but the size is ${size} bytes (expected ${modelSizes[model]} bytes). Delete ${filePath} and try again.`,
);
}
return Promise.resolve({alreadyExisted: false});
}
const baseModelUrl = `https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-${model}.bin`;
if (printOutput) {
console.log(`Downloading whisper model ${model} from ${baseModelUrl}`);
}
const fileStream = fs.createWriteStream(filePath);
await downloadFile({
fileStream,
url: baseModelUrl,
printOutput,View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Delete the file at the path shown in the message and re-run `downloadWhisperModel`.
- If you call it programmatically in a pipeline, pass `printOutput: false` so a size mismatch triggers an automatic re-download instead of throwing.
- Ensure stable network and sufficient disk space before re-downloading large models (some are ~3GB).
Example fix
// before
downloadWhisperModel({model: 'large-v3', folder: 'whisper'});
// after (auto-recover from partial downloads)
downloadWhisperModel({
model: 'large-v3',
folder: 'whisper',
printOutput: false,
}); Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs';
function modelFileIsValid(folder: string, model: string, expectedSize: number): boolean {
const p = `${folder}/ggml-${model}.bin`;
return fs.existsSync(p) && fs.statSync(p).size === expectedSize;
}
if (!modelFileIsValid(folder, model, modelSizes[model])) {
fs.rmSync(`${folder}/ggml-${model}.bin`, {force: true});
} Try / catch
try {
await downloadWhisperModel({model, folder});
} catch (err) {
if (/size is .* bytes \(expected/.test(String(err))) {
fs.rmSync(`${folder}/ggml-${model}.bin`, {force: true});
return downloadWhisperModel({model, folder}); // retry once after cleanup
}
throw err;
} Prevention
- In CI, start from a clean cache or verify file size before reusing a downloaded model.
- Pass printOutput: false in pipelines so partial files auto-trigger a re-download.
- Ensure downloads are not interrupted (stable network, enough disk for ~3GB models).
When it happens
Trigger: A previous download was interrupted, leaving a truncated `ggml-<model>.bin`; someone copied a different file to that path; disk corruption changed the file size. The size check `fs.statSync(filePath).size === modelSizes[model]` fails.
Common situations: CI cancelled mid-download leaving a partial file; running out of disk during download; switching model versions but reusing the same folder; manual file management.
Related errors
- Failed to download whisper model
- Content-Length header not found
- Whisper folder ${to} exists but the executable (${getWhisper
- Error: Model ${model} does not exist at ${modelFolder ? mode
- The public directory was specified as "${p}", and while this
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/8e67f1a4419545ac.
Report an issue: GitHub.