{"record":{"id":"9f20c8bd4e628bd5","repo":"remotion-dev/remotion","slug":"temperature-must-be-a-finite-number-greater-than-0","errorCode":null,"errorMessage":"temperature must be a finite number greater than 0.","messagePattern":"temperature must be a finite number greater than 0\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/whisper-webgpu/src/transcribe.ts","lineNumber":91,"sourceCode":"\t\t!Number.isFinite(strideLengthInSeconds) ||\n\t\tstrideLengthInSeconds < 0 ||\n\t\tstrideLengthInSeconds * 2 >= chunkLengthInSeconds\n\t) {\n\t\tthrow new Error(\n\t\t\t'strideLengthInSeconds must be a finite, non-negative number and less than half of chunkLengthInSeconds.',\n\t\t);\n\t}\n\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\".');","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/whisper-webgpu/src/transcribe.ts#L73-L109","documentation":"transcribe() validates that temperature is a finite number strictly greater than 0. Temperature 0 is disallowed because sampling with temperature 0 is undefined; use doSample=false for greedy decoding instead. Non-finite or <=0 values throw a TypeError.","triggerScenarios":"Passing temperature: 0 expecting greedy decoding, a negative temperature, or NaN/Infinity from unparsed numeric config.","commonSituations":"Porting configs from other Whisper implementations where temperature 0 is legal; string configs not converted to numbers; confusing temperature with another parameter's range.","solutions":["Use a temperature > 0 (e.g. 0.6)","Set doSample: false for deterministic greedy decoding instead of temperature 0","Parse numeric config values with Number() and check Number.isFinite before calling"],"exampleFix":"// before\nawait transcribe({doSample: true, temperature: 0});\n// after\nawait transcribe({doSample: false}); // greedy; or temperature: 0.6 with doSample: true","handlingStrategy":"validation","validationCode":"if (!Number.isFinite(temperature) || temperature <= 0) throw new Error('temperature must be a finite number > 0');","typeGuard":"const isValidTemperature = (t: unknown): t is number => typeof t === 'number' && Number.isFinite(t) && t > 0;","tryCatchPattern":"try {\n  await transcribe(options);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('temperature')) {\n    options.doSample = false; // fall back to greedy decoding\n  } else throw e;\n}","preventionTips":["Use doSample: false for greedy decoding, not temperature: 0","Keep sampling ranges documented (temperature > 0, topK >= 0, etc.)","Parse config numbers with Number() and Number.isFinite checks"],"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"}