langgenius/dify · warning · SpeechToTextDisabledError
speech_to_text_disabled
speech_to_text_disabled
Error message
Speech to text is disabled.
What it means
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.
Source
Thrown at api/controllers/console/explore/trial.py:692
file=file,
session=db.session(),
end_user=None,
)
RecommendedAppService.add_trial_app_record(app_id, user_id, session=db.session())
return response
except services.errors.app_model_config.AppModelConfigBrokenError:
logger.exception("App model config broken.")
raise AppUnavailableError()
except NoAudioUploadedServiceError:
raise NoAudioUploadedError()
except AudioTooLargeServiceError as e:
raise AudioTooLargeError(str(e))
except UnsupportedAudioTypeServiceError:
raise UnsupportedAudioTypeError()
except ProviderNotSupportSpeechToTextServiceError:
raise ProviderNotSupportSpeechToTextError()
except SpeechToTextDisabledServiceError:
raise SpeechToTextDisabledError()
except ProviderTokenNotInitError as ex:
raise ProviderNotInitializeError(ex.description)
except QuotaExceededError:
raise ProviderQuotaExceededError()
except ModelCurrentlyNotSupportError:
raise ProviderModelCurrentlyNotSupportError()
except InvokeError as e:
raise CompletionRequestError(e.description)
except ValueError as e:
raise e
except Exception as e:
logger.exception("internal server error.")
raise InternalServerError()
class TrialChatTextApi(TrialAppResource):
@console_ns.expect(console_ns.models[TextToSpeechRequest.__name__])
@console_ns.response(200, "Success", console_ns.models[AudioBinaryResponse.__name__])View on GitHub (pinned to ef8544b173)
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.
Example fix
// before - always show mic
<MicButton onSubmit={uploadAudio} />
// after - gate on app config
{app.speech_to_text?.enabled && <MicButton onSubmit={uploadAudio} />} Defensive patterns
Strategy: validation
Validate before calling
const app = await fetch(`/console/api/explore/apps/${appId}`).then(r => r.json())
if (!app.model_config?.speech_to_text?.enabled) {
// do not show the mic / do not POST audio
} Type guard
function isSpeechToTextEnabled(app: any): boolean {
return Boolean(app?.model_config?.speech_to_text?.enabled)
} Try / catch
try {
const r = await fetch(audioUrl, { method: 'POST', body: fd })
if (r.status === 400) {
const body = await r.json()
if (body.code === 'speech_to_text_disabled') hideMicControl()
}
} catch (e) { reportToUser(e) } Prevention
- 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.
When it happens
Trigger: POST TrialChatAudioApi for an app whose `speech_to_text.enabled` config is false or absent, but the client still sends an audio file.
Common situations: 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.
Related errors
- provider_not_support_speech_to_text
- app_suggested_questions_after_answer_disabled
- no_audio_uploaded
- audio_too_large
- unsupported_audio_type
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/d7f08ce15c7a6c07.
Report an issue: GitHub.