remotion-dev/remotion · error
strideLengthInSeconds must be non-negative and less than hal
Error message
strideLengthInSeconds must be non-negative and less than half of chunkLengthInSeconds.
What it means
`strideLengthInSeconds` must be a finite, non-negative number and strictly less than half of chunkLengthInSeconds. The stride controls overlap between consecutive chunks; a stride at or above half the chunk length would break the chunking invariants.
Source
Thrown at packages/studio/src/components/WebMcp.tsx:559
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' ||
!Number.isFinite(repetitionPenalty) ||
repetitionPenalty <= 0 ||
typeof topK !== 'number' ||
!Number.isInteger(topK) ||
topK < 0 ||
typeof noRepeatNgramSize !== 'number' ||
!Number.isInteger(noRepeatNgramSize) ||
noRepeatNgramSize < 0
) {View on GitHub (pinned to b2f4e34732)
Solutions
- Use a small stride such as 5 (the default) with the default 30-second chunk
- Ensure stride * 2 < chunkLengthInSeconds
- Omit the field to use the default stride of 5
Example fix
// before
{ "chunkLengthInSeconds": 30, "strideLengthInSeconds": 20 }
// after
{ "chunkLengthInSeconds": 30, "strideLengthInSeconds": 5 } Defensive patterns
Strategy: validation
Validate before calling
const valid = typeof s === 'number' && Number.isFinite(s) && s >= 0 && s * 2 < chunkLength;
if (!valid) throw new Error('stride must satisfy 0 <= stride < chunkLength/2'); Type guard
const isValidStride = (s: unknown, chunkLength: number): s is number => typeof s === 'number' && Number.isFinite(s) && s >= 0 && s * 2 < chunkLength;
Try / catch
try {
await callWhisperTool({ chunkLengthInSeconds: c, strideLengthInSeconds: s });
} catch (err) {
if (err instanceof Error && err.message.includes('strideLengthInSeconds')) {
s = Math.min(s, c / 4); // clamp to a safe quarter-chunk stride
}
} Prevention
- Apply the invariant stride * 2 < chunkLength when configuring
- Use the default stride of 5 unless you know you need overlap control
- Reject negative or non-finite values at input time
When it happens
Trigger: Passing strideLengthInSeconds >= chunkLengthInSeconds / 2 (e.g. stride 15 with chunk 30), a negative value, NaN/Infinity, or a non-number.
Common situations: Setting stride equal to chunk length (assuming no overlap allowed); confusing stride semantics with sliding-window step sizes used elsewhere.
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
- chunkLengthInSeconds must be between 1 and 30.
- "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/664be2acde901b74.
Report an issue: GitHub.