{"record":{"id":"e0d12c3bfff25f5b","repo":"microsoft/semantic-kernel","slug":"the-audio-transcription-format-responseformat","errorCode":null,"errorMessage":"The audio transcription format '{responseFormat}' is not supported.","messagePattern":"The audio transcription format '(.+?)' is not supported\\.","errorType":"validation","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.AudioToText.cs","lineNumber":106,"sourceCode":"        }\n\n        return result;\n    }\n\n    private static AudioTranscriptionFormat? ConvertResponseFormat(string? responseFormat)\n    {\n        if (responseFormat is null)\n        {\n            return null;\n        }\n\n        return responseFormat switch\n        {\n            \"json\" => AudioTranscriptionFormat.Simple,\n            \"verbose_json\" => AudioTranscriptionFormat.Verbose,\n            \"vtt\" => AudioTranscriptionFormat.Vtt,\n            \"srt\" => AudioTranscriptionFormat.Srt,\n            _ => throw new NotSupportedException($\"The audio transcription format '{responseFormat}' is not supported.\")\n        };\n    }\n\n    private static Dictionary<string, object?> GetResponseMetadata(AudioTranscription audioTranscription)\n        => new(3)\n        {\n            [nameof(audioTranscription.Language)] = audioTranscription.Language,\n            [nameof(audioTranscription.Duration)] = audioTranscription.Duration,\n            [nameof(audioTranscription.Segments)] = audioTranscription.Segments\n        };\n}\n","sourceCodeStart":88,"sourceCodeEnd":118,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.AudioToText.cs#L88-L118","documentation":"Thrown by GetAudioTranscriptionFormat when mapping the provider's response-format string to the internal AudioTranscriptionFormat enum. The switch only recognizes the four formats the Whisper/OpenAI audio-transcription endpoint returns: 'json', 'verbose_json', 'vtt', and 'srt'. Any other string indicates an API/SDK drift (e.g. the service added a format the connector does not yet model) and is rejected rather than silently miscategorized.","triggerScenarios":"The OpenAI audio-transcription (speech-to-text) call returns a responseFormat value that is not one of json, verbose_json, vtt, or srt. Typically happens when the response format was set on the request to a value like 'text', 'mp3', or a typo, and the connector tries to normalize it back into an enum.","commonSituations":"Upgrading the OpenAI service to a version that emits a new transcription format while still on an older Connectors.OpenAI package; passing a raw mime-type ('audio/srt') instead of the logical format token ('srt'); copy-pasting a format string from a different SDK.","solutions":["Use only one of the supported tokens: 'json', 'verbose_json', 'vtt', or 'srt' for the response format.","If a genuinely new format is required, upgrade the Microsoft.SematicKernel.Connectors.OpenAI package to a release that maps it.","Inspect the exact responseFormat string at runtime (log it before the call) and correct the source producing it.","Avoid feeding mime-types (e.g. 'audio/vtt'); pass the bare format name."],"exampleFix":"// before\nsettings.ResponseFormat = \"audio/srt\";\n// after\nsettings.ResponseFormat = \"srt\";","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> SupportedAudioFormats = new(StringComparer.OrdinalIgnoreCase) { \"json\", \"verbose_json\", \"vtt\", \"srt\" };\nstatic string NormalizeAudioFormat(string f) => SupportedAudioFormats.Contains(f) ? f.ToLowerInvariant() : throw new ArgumentException($\"Use one of: {string.Join(\", \", SupportedAudioFormats)}\");","typeGuard":"static bool IsValidAudioFormat(string? f) => f is not null && SupportedAudioFormats.Contains(f);","tryCatchPattern":"try { await kernel.InvokeAsync(audioToText, settings); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"audio transcription format\")) { /* log + fall back to 'json' */ }","preventionTips":["Whitelist the four format tokens at the config boundary.","Never pass raw mime-types as the response format."],"tags":["openai","audio-to-text","audio-transcription","format-mapping"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}