moeru-ai/airi · error · Error

File input is required for transcription.

Error message

File input is required for transcription.

What it means

The non-streaming transcription path calls generateTranscription, which requires normalizedInput.file. When the caller supplied no file — only a stream input on a provider without stream support, or nothing at all after input normalization — this precondition throws before any provider request is made. It is the plain 'you gave me no audio file' guard for generate-mode STT.

Source

Thrown at packages/stage-ui/src/stores/modules/hearing.ts:499

        if (features.supportsStreamInput && !normalizedInput.inputAudioStream && normalizedInput.file) {
          const streamResult = streamExecutor({
            ...request,
            file: normalizedInput.file,
          } as Parameters<typeof streamExecutor>[0])
          emitSucceeded(0, true)
          return {
            mode: 'stream',
            ...streamResult,
          }
        }

        if (!features.supportsGenerate || !normalizedInput.file) {
          throw new Error('No compatible input provided for streaming transcription.')
        }
      }

      if (!normalizedInput.file) {
        throw new Error('File input is required for transcription.')
      }

      const useVerboseJson = !format && confidenceThreshold.value > CONFIDENCE_THRESHOLD_DISABLED
      const response = await generateTranscription({
        ...provider.transcription(model, options?.providerOptions),
        file: normalizedInput.file,
        fileName: resolveTranscriptionFileName(normalizedInput.file, normalizedInput.fileName),
        responseFormat: useVerboseJson ? 'verbose_json' : format,
      })

      if (useVerboseJson) {
        if (response.segments) {
          verboseJsonNotSupported.value = false
          const filteredText = filterTranscriptionByConfidence(response.segments, confidenceThreshold.value)
          emitSucceeded(filteredText.length, false)
          return {
            mode: 'generate',
            ...response,

View on GitHub (pinned to f679616c34)

Solutions

  1. Produce and pass a file: record the audio to a Blob/File before calling transcription.
  2. Choose a provider that supports stream input when you only have a live stream.
  3. Validate that a file exists in normalized input before invoking transcription and surface a capture error early.
  4. Fix the recording pipeline when it silently yields no file.

Example fix

// before
const result = await hearing.transcribe(model, {})

// after
if (!recordedBlob) {
  toast.info('No recorded audio to transcribe')
  return
}
const result = await hearing.transcribe(model, { file: recordedBlob })
Defensive patterns

Strategy: validation

Validate before calling

if (!input.file) {
  toast.info('No recorded audio to transcribe')
  return
}
await hearing.transcribe(model, { file: input.file })

Type guard

function hasTranscribableFile(input: unknown): input is { file: Blob } {
  return typeof input === 'object' && input !== null
    && input.file instanceof Blob
    && input.file.size > 0
}

Try / catch

try {
  const result = await hearing.transcribe(model, input)
}
catch (error) {
  if (errorMessageFrom(error) === 'File input is required for transcription.') {
    // capture produced nothing: reset the recorder instead of showing a hard error
    resetRecorder()
    return
  }
  throw error
}

Prevention

When it happens

Trigger: Using a generate-only (non-stream) STT provider while only an inputAudioStream is available; microphone recording failing so no Blob/File was produced; calling transcribe with only options and no audio input; a file-only provider receiving a stream-oriented request object.

Common situations: Live-mic flows wired to providers that only support batch file transcription; audio recorder errors swallowed upstream so downstream sees an empty input; programmatic use of the hearing store without attaching captured audio.

Related errors


AI-assisted analysis of moeru-ai/airi@f679616c34 (2026-08-18). Data as JSON: /api/errors/9af7cf51ee1fb622. Report an issue: GitHub.