{"record":{"id":"5aa2294f91a738e4","repo":"moeru-ai/airi","slug":"apple-speech-live-transcription-requires-an-audio","errorCode":null,"errorMessage":"Apple Speech live transcription requires an audio stream.","messagePattern":"Apple Speech live transcription requires an audio stream\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/stage-ui/src/libs/providers/providers/apple-speech/index.ts","lineNumber":195,"sourceCode":"    await writer.abort(error).catch(() => {})\n    throw error\n  }\n  finally {\n    reader.releaseLock()\n  }\n}\n\n/**\n * Adapts AIRI's mono PCM16 VAD stream to Apple Speech live transcription.\n *\n * The Provider boundary converts each audio chunk and maps Apple replacement\n * events to AIRI transcript snapshots.\n */\nexport function executeAppleSpeechStream(options: AppleSpeechStreamOptions): AIRIStreamTranscriptionResult\nexport function executeAppleSpeechStream(options: StreamTranscriptionOptions): AIRIStreamTranscriptionResult\nexport function executeAppleSpeechStream(options: StreamTranscriptionOptions): AIRIStreamTranscriptionResult {\n  if (!options.inputAudioStream)\n    throw new TypeError('Apple Speech live transcription requires an audio stream.')\n  if (!isAppleSpeechStreamRequest(options))\n    throw new TypeError('Apple Speech live transcription requires a native stream request.')\n\n  const inputSampleRate = options.inputSampleRate ?? 16000\n  const live = streamAppleSpeechTranscription({\n    ...options,\n    inputSampleRate,\n  })\n  const inputPump = pumpPcm16Input(options.inputAudioStream, live.input.getWriter())\n  void inputPump.catch(() => {})\n\n  return {\n    fullStream: live.fullStream.pipeThrough(new TransformStream({\n      transform(event, controller) {\n        controller.enqueue(appleEventSnapshot(event))\n      },\n    })),\n    text: Promise.all([live.text, inputPump]).then(([text]) => text),","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/moeru-ai/airi/blob/f679616c34f1cf6d282c8d64264242af944b3fed/packages/stage-ui/src/libs/providers/providers/apple-speech/index.ts#L177-L213","documentation":"executeAppleSpeechStream requires a live audio input; options.inputAudioStream must be present because Apple Speech live transcription consumes a continuous PCM stream fed to the native recognizer. A one-shot request shape (e.g. only a request payload with no stream) is rejected with a TypeError.","triggerScenarios":"Calling executeAppleSpeechStream with options that lack inputAudioStream, e.g. passing a plain StreamTranscriptionOptions object intended for another provider, or building AppleSpeechStreamOptions manually and forgetting the stream.","commonSituations":"Generic provider-agnostic code passing a shared options object to every transcription provider; refactoring that renamed or moved the stream field; a caller assuming the provider polls a microphone itself instead of receiving the stream.","solutions":["Pass an inputAudioStream (e.g. a MediaStream/MediaStreamTrack audio pipe) in options when calling executeAppleSpeechStream.","If your options object is generic, branch: use the stream API only when audio streaming is available, otherwise use a non-streaming transcription call.","Check upstream option construction for a dropped/renamed inputAudioStream field after refactors."],"exampleFix":"// before\nconst result = executeAppleSpeechStream({ request })\n\n// after\nconst result = executeAppleSpeechStream({\n  request,\n  inputAudioStream: micAudioStream,\n})","handlingStrategy":"validation","validationCode":"if (!options.inputAudioStream) {\n  throw new TypeError('Caller must supply an audio stream before starting live transcription.')\n}\nconst result = executeAppleSpeechStream(options)","typeGuard":"function isStreamTranscriptionReady(options: StreamTranscriptionOptions): boolean {\n  return options.inputAudioStream != null\n}","tryCatchPattern":"null","preventionTips":["Acquire the microphone/audio stream before constructing transcription options.","Type the call site with AppleSpeechStreamOptions so the stream field is required at compile time.","Fail fast in UI: disable 'start live transcription' until audio permission and stream are active."],"tags":["apple-speech","transcription","stream","argument-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"f679616c34f1cf6d282c8d64264242af944b3fed","analyzedAt":"2026-08-28T13:11:01.995Z","contentChangedAt":"2026-08-28T13:11:01.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}