remotion-dev/remotion · error · TypeError

temperature must be a finite number greater than 0.

Error message

temperature must be a finite number greater than 0.

What it means

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.

Source

Thrown at packages/whisper-webgpu/src/transcribe.ts:91

		!Number.isFinite(strideLengthInSeconds) ||
		strideLengthInSeconds < 0 ||
		strideLengthInSeconds * 2 >= chunkLengthInSeconds
	) {
		throw new Error(
			'strideLengthInSeconds must be a finite, non-negative number and less than half of chunkLengthInSeconds.',
		);
	}

	if (typeof forceFullSequences !== 'boolean') {
		throw new TypeError('forceFullSequences must be a boolean.');
	}

	if (typeof doSample !== 'boolean') {
		throw new TypeError('doSample must be a boolean.');
	}

	if (!Number.isFinite(temperature) || temperature <= 0) {
		throw new TypeError('temperature must be a finite number greater than 0.');
	}

	if (!Number.isInteger(topK) || topK < 0) {
		throw new TypeError('topK must be a non-negative integer.');
	}

	if (!Number.isFinite(repetitionPenalty) || repetitionPenalty <= 0) {
		throw new TypeError(
			'repetitionPenalty must be a finite number greater than 0.',
		);
	}

	if (!Number.isInteger(noRepeatNgramSize) || noRepeatNgramSize < 0) {
		throw new TypeError('noRepeatNgramSize must be a non-negative integer.');
	}

	if (task !== 'transcribe' && task !== 'translate') {
		throw new TypeError('task must be either "transcribe" or "translate".');

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Use a temperature > 0 (e.g. 0.6)
  2. Set doSample: false for deterministic greedy decoding instead of temperature 0
  3. Parse numeric config values with Number() and check Number.isFinite before calling

Example fix

// before
await transcribe({doSample: true, temperature: 0});
// after
await transcribe({doSample: false}); // greedy; or temperature: 0.6 with doSample: true
Defensive patterns

Strategy: validation

Validate before calling

if (!Number.isFinite(temperature) || temperature <= 0) throw new Error('temperature must be a finite number > 0');

Type guard

const isValidTemperature = (t: unknown): t is number => typeof t === 'number' && Number.isFinite(t) && t > 0;

Try / catch

try {
  await transcribe(options);
} catch (e) {
  if (e instanceof TypeError && e.message.includes('temperature')) {
    options.doSample = false; // fall back to greedy decoding
  } else throw e;
}

Prevention

When it happens

Trigger: Passing temperature: 0 expecting greedy decoding, a negative temperature, or NaN/Infinity from unparsed numeric config.

Common situations: Porting configs from other Whisper implementations where temperature 0 is legal; string configs not converted to numbers; confusing temperature with another parameter's range.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09). Data as JSON: /api/errors/9f20c8bd4e628bd5. Report an issue: GitHub.