{"record":{"id":"4c5f7fa8a9b60e5c","repo":"remotion-dev/remotion","slug":"dosample-must-be-a-boolean","errorCode":null,"errorMessage":"doSample must be a boolean.","messagePattern":"doSample must be a boolean\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/whisper-webgpu/src/transcribe.ts","lineNumber":87,"sourceCode":"\t\t);\n\t}\n\n\tif (\n\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.');","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/whisper-webgpu/src/transcribe.ts#L69-L105","documentation":"transcribe() validates the decoding option doSample, which switches between sampling and greedy decoding, requiring a strict boolean. Non-boolean inputs are rejected before any model work, following the forceFullSequences check.","triggerScenarios":"Passing doSample as undefined, a string ('false'), or a number (0/1); constructing options from JSON/CLI input without boolean conversion.","commonSituations":"Sampling options persisted in a config file as strings; UI checkbox values bound to 'on'/'off' strings; missing key in a partially-built options object.","solutions":["Pass doSample: true or false explicitly","Convert config values: doSample: Boolean(raw) or raw === 'true'","Check that the option object is complete and not spread from a partial source"],"exampleFix":"// before\nawait transcribe({doSample: 'false'});\n// after\nawait transcribe({doSample: false});","handlingStrategy":"type-guard","validationCode":"if (typeof doSample !== 'boolean') throw new Error('doSample must be a boolean');","typeGuard":"const isBool = (v: unknown): v is boolean => typeof v === 'boolean';","tryCatchPattern":"try {\n  await transcribe(options);\n} catch (e) {\n  if (e instanceof TypeError && e.message.startsWith('doSample')) {\n    options.doSample = options.doSample === 'true';\n  } else throw e;\n}","preventionTips":["Persist booleans as real booleans in JSON config","Bind UI checkboxes to boolean values, not 'on'/'off' strings","Type the options object so omitted keys are caught at compile time"],"tags":["validation","typecheck","whisper"],"backgroundTag":"type-mismatch","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"}