{"record":{"id":"f67680f85882bba5","repo":"remotion-dev/remotion","slug":"language-must-be-a-non-empty-string","errorCode":null,"errorMessage":"language must be a non-empty string.","messagePattern":"language must be a non-empty string\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/WebMcp.tsx","lineNumber":535,"sourceCode":"\t\t\t\t\t\tconst model = whisper\n\t\t\t\t\t\t\t.getAvailableModels()\n\t\t\t\t\t\t\t.find((candidate) => candidate.name === modelName);\n\t\t\t\t\t\tif (!model) {\n\t\t\t\t\t\t\tthrow new Error(`Unknown Whisper model: ${modelName}.`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst task = input.task ?? 'transcribe';\n\t\t\t\t\t\tif (task !== 'transcribe' && task !== 'translate') {\n\t\t\t\t\t\t\tthrow new Error('task must be transcribe or translate.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (task === 'translate' && !model.supportsTranslation) {\n\t\t\t\t\t\t\tthrow new Error(`${model.name} does not support translation.`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst language = input.language ?? 'en';\n\t\t\t\t\t\tif (typeof language !== 'string' || language.length === 0) {\n\t\t\t\t\t\t\tthrow new Error('language must be a non-empty string.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst chunkLengthInSeconds = input.chunkLengthInSeconds ?? 30;\n\t\t\t\t\t\tconst strideLengthInSeconds = input.strideLengthInSeconds ?? 5;\n\t\t\t\t\t\tconst temperature = input.temperature ?? 1;\n\t\t\t\t\t\tconst topK = input.topK ?? 50;\n\t\t\t\t\t\tconst repetitionPenalty = input.repetitionPenalty ?? 1;\n\t\t\t\t\t\tconst noRepeatNgramSize = input.noRepeatNgramSize ?? 0;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof chunkLengthInSeconds !== 'number' ||\n\t\t\t\t\t\t\t!Number.isFinite(chunkLengthInSeconds) ||\n\t\t\t\t\t\t\tchunkLengthInSeconds < 1 ||\n\t\t\t\t\t\t\tchunkLengthInSeconds > 30\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error('chunkLengthInSeconds must be between 1 and 30.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/components/WebMcp.tsx#L517-L553","documentation":"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.","triggerScenarios":"Passing input.language as \"\", null combined with explicit undefined handling, a number, an array, or any non-string value.","commonSituations":"Clearing a language field in a UI and submitting an empty string; passing a locale object instead of an ISO-639-1 code string.","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"],"exampleFix":"// before\n{ \"language\": \"\" }\n// after\n{ \"language\": \"de\" } // or omit to default to \"en\"","handlingStrategy":"type-guard","validationCode":"if (input.language !== undefined && (typeof input.language !== 'string' || input.language.trim() === '')) {\n  throw new Error('language must be a non-empty string');\n}","typeGuard":"const isValidLanguage = (v: unknown): v is string =>\n  typeof v === 'string' && v.length > 0;","tryCatchPattern":"try {\n  await callWhisperTool({ language: input.language });\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('language must be')) {\n    delete input.language; // use default 'en'\n  }\n}","preventionTips":["Omit language rather than sending \"\"","Use ISO-639-1 code strings like \"en\", \"de\"","Trim and validate user input before submission"],"tags":["validation","whisper","type-error"],"backgroundTag":"empty-required-field","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}