{"record":{"id":"b312be41f57171e6","repo":"remotion-dev/remotion","slug":"norepeatngramsize-must-be-a-non-negative-integer","errorCode":null,"errorMessage":"noRepeatNgramSize must be a non-negative integer.","messagePattern":"noRepeatNgramSize must be a non-negative integer\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/whisper-webgpu/src/transcribe.ts","lineNumber":105,"sourceCode":"\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')) {\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 (","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/whisper-webgpu/src/transcribe.ts#L87-L123","documentation":"transcribe() validates the decoding option noRepeatNgramSize: it must be an integer >= 0 (0 disables the constraint). Fractional, negative, or non-number values are rejected with a TypeError during option validation.","triggerScenarios":"Passing noRepeatNgramSize as a float, negative number, NaN, or string from unconverted config input.","commonSituations":"Numeric strings from JSON/env config; computing the value dynamically with possible NaN; unclear about 0 being allowed to disable n-gram blocking.","solutions":["Pass an integer >= 0 (0 disables n-gram repetition blocking)","Sanitize with Math.max(0, Math.round(Number(raw)))","Validate option types when loading from JSON config files"],"exampleFix":"// before\nawait transcribe({noRepeatNgramSize: -1});\n// after\nawait transcribe({noRepeatNgramSize: 0}); // disabled, or e.g. 3","handlingStrategy":"validation","validationCode":"if (!Number.isInteger(noRepeatNgramSize) || noRepeatNgramSize < 0) throw new Error('noRepeatNgramSize must be a non-negative integer');","typeGuard":"const isNonNegInt = (v: unknown): v is number => typeof v === 'number' && Number.isInteger(v) && v >= 0;","tryCatchPattern":"try {\n  await transcribe(options);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('noRepeatNgramSize')) {\n    options.noRepeatNgramSize = 0;\n  } else throw e;\n}","preventionTips":["Use 0 to disable n-gram blocking, not null or negative values","Normalize all integer options with Math.round/Math.max at load time","Type sampling options as integers so TS flags float assignments"],"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-14T05:17:10.506Z"}