{"record":{"id":"d7f08ce15c7a6c07","repo":"langgenius/dify","slug":"speech-to-text-disabled-d7f08c","errorCode":"speech_to_text_disabled","errorMessage":"Speech to text is disabled.","messagePattern":"Speech to text is disabled\\.","errorType":"error_code","errorClass":"SpeechToTextDisabledError","httpStatus":400,"severity":"warning","filePath":"api/controllers/console/explore/trial.py","lineNumber":692,"sourceCode":"                file=file,\n                session=db.session(),\n                end_user=None,\n            )\n            RecommendedAppService.add_trial_app_record(app_id, user_id, session=db.session())\n            return response\n        except services.errors.app_model_config.AppModelConfigBrokenError:\n            logger.exception(\"App model config broken.\")\n            raise AppUnavailableError()\n        except NoAudioUploadedServiceError:\n            raise NoAudioUploadedError()\n        except AudioTooLargeServiceError as e:\n            raise AudioTooLargeError(str(e))\n        except UnsupportedAudioTypeServiceError:\n            raise UnsupportedAudioTypeError()\n        except ProviderNotSupportSpeechToTextServiceError:\n            raise ProviderNotSupportSpeechToTextError()\n        except SpeechToTextDisabledServiceError:\n            raise SpeechToTextDisabledError()\n        except ProviderTokenNotInitError as ex:\n            raise ProviderNotInitializeError(ex.description)\n        except QuotaExceededError:\n            raise ProviderQuotaExceededError()\n        except ModelCurrentlyNotSupportError:\n            raise ProviderModelCurrentlyNotSupportError()\n        except InvokeError as e:\n            raise CompletionRequestError(e.description)\n        except ValueError as e:\n            raise e\n        except Exception as e:\n            logger.exception(\"internal server error.\")\n            raise InternalServerError()\n\n\nclass TrialChatTextApi(TrialAppResource):\n    @console_ns.expect(console_ns.models[TextToSpeechRequest.__name__])\n    @console_ns.response(200, \"Success\", console_ns.models[AudioBinaryResponse.__name__])","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/explore/trial.py#L674-L710","documentation":"HTTP 400 with error_code `speech_to_text_disabled`, raised by SpeechToTextDisabledError when AudioService raises SpeechToTextDisabledServiceError. The app's speech-to-text feature flag is off in the model config, so the controller refuses the upload before any provider work. This is a configuration gate analogous to the suggested-questions disabled error.","triggerScenarios":"POST TrialChatAudioApi for an app whose `speech_to_text.enabled` config is false or absent, but the client still sends an audio file.","commonSituations":"UI shows a microphone button for an app that has STT disabled; app cloned from a template with STT off; operator disabled STT to save cost but the client was not updated.","solutions":["Enable speech-to-text in the app studio (App Settings -> Speech to text), then publish.","Hide the audio upload control in the client when the app config reports STT disabled.","Do not retry - deterministic until the app config changes."],"exampleFix":"// before - always show mic\n<MicButton onSubmit={uploadAudio} />\n\n// after - gate on app config\n{app.speech_to_text?.enabled && <MicButton onSubmit={uploadAudio} />}","handlingStrategy":"validation","validationCode":"const app = await fetch(`/console/api/explore/apps/${appId}`).then(r => r.json())\nif (!app.model_config?.speech_to_text?.enabled) {\n  // do not show the mic / do not POST audio\n}","typeGuard":"function isSpeechToTextEnabled(app: any): boolean {\n  return Boolean(app?.model_config?.speech_to_text?.enabled)\n}","tryCatchPattern":"try {\n  const r = await fetch(audioUrl, { method: 'POST', body: fd })\n  if (r.status === 400) {\n    const body = await r.json()\n    if (body.code === 'speech_to_text_disabled') hideMicControl()\n  }\n} catch (e) { reportToUser(e) }","preventionTips":["Gate the mic UI on the app's speech_to_text.enabled config.","Do not retry this code; enable the feature in the studio instead.","Keep client app-config state in sync after the owner toggles STT."],"tags":["dify","trial-api","console","explore","audio","speech-to-text","feature-disabled","http-400","config"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}