{"record":{"id":"11d77710d263380e","repo":"remotion-dev/remotion","slug":"repetitionpenalty-must-be-a-finite-number-greater","errorCode":null,"errorMessage":"repetitionPenalty must be a finite number greater than 0.","messagePattern":"repetitionPenalty must be a finite number greater than 0\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/whisper-webgpu/src/transcribe.ts","lineNumber":99,"sourceCode":"\n\tif (typeof forceFullSequences !== 'boolean') {\n\t\tthrow new TypeError('forceFullSequences must be a boolean.');\n\t}\n\n\tif (typeof doSample !== 'boolean') {\n\t\tthrow new TypeError('doSample must be a boolean.');\n\t}\n\n\tif (!Number.isFinite(temperature) || temperature <= 0) {\n\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')) {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/whisper-webgpu/src/transcribe.ts#L81-L117","documentation":"transcribe() validates the decoding option repetitionPenalty: it must be a finite number greater than 0 (values <= 0 or non-finite are meaningless penalties). A TypeError is thrown during option validation before the model runs.","triggerScenarios":"Passing repetitionPenalty: 0 (expecting 'no penalty'), a negative value, NaN/Infinity, or an unparsed string.","commonSituations":"Confusing penalty semantics where 1.0 means neutral; config values stored as strings; uninitialized variables yielding NaN.","solutions":["Use repetitionPenalty >= 1.0 (1.0 disables the penalty)","Parse with Number() and verify Number.isFinite before calling","If no penalty is desired, pass 1 rather than 0"],"exampleFix":"// before\nawait transcribe({repetitionPenalty: 0});\n// after\nawait transcribe({repetitionPenalty: 1.2});","handlingStrategy":"validation","validationCode":"if (!Number.isFinite(repetitionPenalty) || repetitionPenalty <= 0) throw new Error('repetitionPenalty must be a finite number > 0');","typeGuard":"const isValidPenalty = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v) && v > 0;","tryCatchPattern":"try {\n  await transcribe(options);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('repetitionPenalty')) {\n    options.repetitionPenalty = 1.0; // neutral\n  } else throw e;\n}","preventionTips":["Remember 1.0 means no penalty — never use 0 to disable it","Validate ranges centrally when loading decoder settings","Avoid spreading unvalidated config objects into transcribe options"],"tags":["validation","sampling","whisper"],"backgroundTag":"argument-out-of-range","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"}