remotion-dev/remotion · error
chunkLengthInSeconds must be between 1 and 30.
Error message
chunkLengthInSeconds must be between 1 and 30.
What it means
`chunkLengthInSeconds` controls the audio window length fed to Whisper and is constrained to the range 1..30 seconds (Whisper's maximum context is 30s). Non-finite, out-of-range, or non-number values throw this error.
Source
Thrown at packages/studio/src/components/WebMcp.tsx:550
const language = input.language ?? 'en';
if (typeof language !== 'string' || language.length === 0) {
throw new Error('language must be a non-empty string.');
}
const chunkLengthInSeconds = input.chunkLengthInSeconds ?? 30;
const strideLengthInSeconds = input.strideLengthInSeconds ?? 5;
const temperature = input.temperature ?? 1;
const topK = input.topK ?? 50;
const repetitionPenalty = input.repetitionPenalty ?? 1;
const noRepeatNgramSize = input.noRepeatNgramSize ?? 0;
if (
typeof chunkLengthInSeconds !== 'number' ||
!Number.isFinite(chunkLengthInSeconds) ||
chunkLengthInSeconds < 1 ||
chunkLengthInSeconds > 30
) {
throw new Error('chunkLengthInSeconds must be between 1 and 30.');
}
if (
typeof strideLengthInSeconds !== 'number' ||
!Number.isFinite(strideLengthInSeconds) ||
strideLengthInSeconds < 0 ||
strideLengthInSeconds * 2 >= chunkLengthInSeconds
) {
throw new Error(
'strideLengthInSeconds must be non-negative and less than half of chunkLengthInSeconds.',
);
}
if (
typeof temperature !== 'number' ||
!Number.isFinite(temperature) ||
temperature <= 0 ||
typeof repetitionPenalty !== 'number' ||View on GitHub (pinned to b2f4e34732)
Solutions
- Use a value between 1 and 30 (the default is 30)
- Omit the field to keep the default 30
- Parse strings to numbers and validate range before calling
Example fix
// before
{ "chunkLengthInSeconds": 60 }
// after
{ "chunkLengthInSeconds": 30 } Defensive patterns
Strategy: validation
Validate before calling
if (typeof input.chunkLengthInSeconds === 'number' && Number.isFinite(input.chunkLengthInSeconds)
&& input.chunkLengthInSeconds >= 1 && input.chunkLengthInSeconds <= 30) {
// safe to call
} Type guard
const isValidChunkLength = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v) && v >= 1 && v <= 30;
Try / catch
try {
await callWhisperTool({ chunkLengthInSeconds: n });
} catch (err) {
if (err instanceof Error && err.message.includes('chunkLengthInSeconds')) {
n = 30; // clamp to default
}
} Prevention
- Remember Whisper's 30-second max context
- Clamp user-provided values with Math.min(30, Math.max(1, n))
- Omit the field for the default of 30
- Ensure values are numbers, not numeric strings
When it happens
Trigger: Passing input.chunkLengthInSeconds = 0, 60, -5, Infinity, NaN, or a string like "30".
Common situations: Assuming chunks can match a long audio file duration; unit confusion (minutes vs seconds); copying a numeric input as a string from JSON config.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- strideLengthInSeconds must be non-negative and less than hal
- "samples" must be >= 1, but got ${JSON.stringify(r.samples)}
- "samples" must be <= ${MAX_SAMPLES}, but got ${JSON.stringif
- Invalid whisper model ${model}. Available: ${models.join(',
- Non-semantic version provided. Only releases of Whisper.cpp
AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09).
Data as JSON: /api/errors/2f35b468e4eb54aa.
Report an issue: GitHub.