{"record":{"id":"2aa60c713da29278","repo":"remotion-dev/remotion","slug":"task-must-be-either-transcribe-or-translate","errorCode":null,"errorMessage":"task must be either \"transcribe\" or \"translate\".","messagePattern":"task must be either \"transcribe\" or \"translate\"\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/whisper-webgpu/src/transcribe.ts","lineNumber":109,"sourceCode":"\t\tthrow new TypeError('temperature must be a finite number greater than 0.');\n\t}\n\n\tif (!Number.isInteger(topK) || topK < 0) {\n\t\tthrow new TypeError('topK must be a non-negative integer.');\n\t}\n\n\tif (!Number.isFinite(repetitionPenalty) || repetitionPenalty <= 0) {\n\t\tthrow new TypeError(\n\t\t\t'repetitionPenalty must be a finite number greater than 0.',\n\t\t);\n\t}\n\n\tif (!Number.isInteger(noRepeatNgramSize) || noRepeatNgramSize < 0) {\n\t\tthrow new TypeError('noRepeatNgramSize must be a non-negative integer.');\n\t}\n\n\tif (task !== 'transcribe' && task !== 'translate') {\n\t\tthrow new TypeError('task must be either \"transcribe\" or \"translate\".');\n\t}\n\n\tconst {multilingual, supportsTranslation} = getModelInfo(model);\n\tif (task === 'translate' && !supportsTranslation) {\n\t\tthrow new Error(`The model \"${model}\" does not support translation.`);\n\t}\n\n\tif (multilingual && (language === undefined || language === 'auto')) {\n\t\tthrow new Error(\n\t\t\t`The language option is required for the multilingual model \"${model}\" because automatic language detection is not supported.`,\n\t\t);\n\t}\n\n\tif (\n\t\t!multilingual &&\n\t\tlanguage !== undefined &&\n\t\tlanguage !== 'auto' &&\n\t\tlanguage !== 'en' &&","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/whisper-webgpu/src/transcribe.ts#L91-L127","documentation":"transcribe() validates the task option against the only two supported values, 'transcribe' and 'translate'. Any other string is rejected with a TypeError before the model info is consulted; passing an unsupported task would otherwise fail inside the model pipeline.","triggerScenarios":"Passing task: 'TRANSCRIBE' (wrong casing), task: 'translation', or leaving task undefined while the code assumes a default.","commonSituations":"Mapping user-facing UI labels to task values without normalization; options read from config keys with different naming; forgetting the option is required, not defaulted.","solutions":["Pass exactly 'transcribe' or 'translate' (lowercase)","Normalize user input with toLowerCase() and map synonyms ('translation' -> 'translate')","Explicitly set task instead of relying on it being optional"],"exampleFix":"// before\nawait transcribe({task: 'TRANSCRIBE'});\n// after\nconst task = rawTask.toLowerCase() === 'translate' ? 'translate' : 'transcribe';\nawait transcribe({task});","handlingStrategy":"type-guard","validationCode":"const tasks = ['transcribe', 'translate'] as const;\nif (!tasks.includes(task as any)) throw new Error(`task must be one of ${tasks.join(', ')}`);","typeGuard":"const isTask = (t: unknown): t is 'transcribe' | 'translate' => t === 'transcribe' || t === 'translate';","tryCatchPattern":"try {\n  await transcribe(options);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('task')) {\n    options.task = 'transcribe';\n  } else throw e;\n}","preventionTips":["Use the exported union type instead of plain strings","Normalize user-facing labels to lowercase before mapping to task","Provide UI selects limited to the two valid values"],"tags":["validation","enum","whisper"],"backgroundTag":"invalid-enum-value","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}