{"record":{"id":"7e1ffa0d3ec9f9d4","repo":"vercel/ai","slug":"provideroptions-xai-channels-is-required-when-prov","errorCode":null,"errorMessage":"providerOptions.xai.channels is required when providerOptions.xai.multichannel is true","messagePattern":"providerOptions\\.xai\\.channels is required when providerOptions\\.xai\\.multichannel is true","errorType":"validation","errorClass":"InvalidArgumentError","httpStatus":null,"severity":"error","filePath":"packages/xai/src/xai-transcription-model.ts","lineNumber":194,"sourceCode":"      },\n    };\n  }\n\n  async doStream(\n    options: TranscriptionModelV4StreamOptions,\n  ): Promise<\n    Awaited<ReturnType<NonNullable<TranscriptionModelV4['doStream']>>>\n  > {\n    const currentDate = this.config._internal?.currentDate?.() ?? new Date();\n    const warnings: SharedV4Warning[] = [];\n    const xaiOptions = await parseProviderOptions({\n      provider: 'xai',\n      providerOptions: options.providerOptions,\n      schema: xaiTranscriptionModelOptionsSchema,\n    });\n\n    if (xaiOptions?.multichannel === true && xaiOptions.channels == null) {\n      throw new InvalidArgumentError({\n        argument: 'providerOptions',\n        message:\n          'providerOptions.xai.channels is required when providerOptions.xai.multichannel is true',\n      });\n    }\n\n    if (xaiOptions?.format != null) {\n      warnings.push({\n        type: 'unsupported',\n        feature: 'providerOptions.xai.format',\n        details: 'xAI streaming transcription does not support format.',\n      });\n    }\n\n    if (\n      xaiOptions?.audioFormat == null &&\n      !isKnownInputAudioFormat(options.inputAudioFormat.type)\n    ) {","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/xai/src/xai-transcription-model.ts#L176-L212","documentation":"doStream in the xAI transcription model validates providerOptions.xai before sending the request: when multichannel is set to true, the channels option must also be provided because xAI's multichannel transcription requires an explicit channel list. If channels is null/undefined while multichannel is true, an InvalidArgumentError is thrown before any network call.","triggerScenarios":"Calling streamObject-style transcription via xai.transcriptionModel(...).doStream (or the transcribe API) with providerOptions: { xai: { multichannel: true } } and omitting providerOptions.xai.channels.","commonSituations":"Enabling multichannel transcription for meeting/stereo audio but forgetting the channel array; copying a config snippet that only shows multichannel; boolean flag toggled on by environment/config without the dependent option.","solutions":["Add providerOptions: { xai: { channels: [...] } } alongside multichannel: true.","Set multichannel to false (or omit it) if channel separation is not actually needed.","Consult the xAI transcription provider options schema for the expected channels shape (array of channel descriptors)."],"exampleFix":"// before\nproviderOptions: { xai: { multichannel: true } }\n\n// after\nproviderOptions: { xai: { multichannel: true, channels: [{ name: 'agent' }, { name: 'caller' }] } }","handlingStrategy":"validation","validationCode":"const xaiOpts = providerOptions?.xai as { multichannel?: boolean; channels?: unknown } | undefined;\nif (xaiOpts?.multichannel === true && xaiOpts.channels == null) {\n  throw new Error('providerOptions.xai.channels is required when multichannel is true');\n}","typeGuard":"function hasValidMultichannelOptions(o: unknown): o is { multichannel: true; channels: unknown[] } {\n  return typeof o === 'object' && o !== null &&\n    (o as any).multichannel === true && Array.isArray((o as any).channels);\n}","tryCatchPattern":"try {\n  await model.doStream({ ...options, providerOptions });\n} catch (e) {\n  if (InvalidArgumentError.isInstance(e) && e.argument === 'providerOptions') {\n    // fix options and retry once with channels included\n  } else throw e;\n}","preventionTips":["Define providerOptions with the exported xai transcription options type so missing fields surface in TypeScript.","Validate dependent options together in your config layer, not at the API boundary.","Document multichannel/channels as a paired option in your team's transcription wrapper."],"tags":["xai","transcription","provider-options","validation"],"backgroundTag":"missing-required-option","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}