remotion-dev/remotion · error
language must be a non-empty string.
Error message
language must be a non-empty string.
What it means
Validation inside the WebMcp transcription tool. The language parameter (defaulting to 'en') must be a non-empty string after input coercion; an empty, null-like, or non-string language value is rejected before transcription begins. This is an input-validation guard on the caller-supplied language field.
Source
Thrown at packages/studio/src/components/WebMcp.tsx:535
const model = whisper
.getAvailableModels()
.find((candidate) => candidate.name === modelName);
if (!model) {
throw new Error(`Unknown Whisper model: ${modelName}.`);
}
const task = input.task ?? 'transcribe';
if (task !== 'transcribe' && task !== 'translate') {
throw new Error('task must be transcribe or translate.');
}
if (task === 'translate' && !model.supportsTranslation) {
throw new Error(`${model.name} does not support translation.`);
}
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 (View on GitHub (pinned to b2f4e34732)
Solutions
- Omit input.language to use the default "en"
- Pass a non-empty language code string such as "en", "de", "zh"
- Trim whitespace before sending to avoid effectively empty values
Example fix
// before
{ "language": "" }
// after
{ "language": "de" } // or omit to default to "en" Defensive patterns
Strategy: type-guard
Validate before calling
if (input.language !== undefined && (typeof input.language !== 'string' || input.language.trim() === '')) {
throw new Error('language must be a non-empty string');
} Type guard
const isValidLanguage = (v: unknown): v is string => typeof v === 'string' && v.length > 0;
Try / catch
try {
await callWhisperTool({ language: input.language });
} catch (err) {
if (err instanceof Error && err.message.startsWith('language must be')) {
delete input.language; // use default 'en'
}
} Prevention
- Omit language rather than sending ""
- Use ISO-639-1 code strings like "en", "de"
- Trim and validate user input before submission
When it happens
Trigger: Passing input.language as "", null combined with explicit undefined handling, a number, an array, or any non-string value.
Common situations: Clearing a language field in a UI and submitting an empty string; passing a locale object instead of an ISO-639-1 code string.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- forceFullSequences and doSample must be booleans.
- "${name}" must be a [number, number] tuple
- Invalid whisper model ${model}. Available: ${models.join(',
- outputRange tuples must contain only finite numbers, but got
- ${name} must contain only numbers
AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09).
Data as JSON: /api/errors/f67680f85882bba5.
Report an issue: GitHub.