langgenius/dify · error · CompletionRequestError
completion_request_error
completion_request_error
Error message
Completion request failed.
What it means
Raised by _transcribe_audio_to_text when AudioService raises InvokeError — a generic provider invocation failure (network, auth, upstream model error, rate limit inside the provider SDK). The controller wraps the description and translates to CompletionRequestError (400, error_code 'completion_request_error').
Source
Thrown at api/controllers/console/app/audio.py:171
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 HTTPException:
raise
except ValueError:
raise
except Exception as e:
logger.exception("Failed to transcribe audio to text")
raise InternalServerError() from e
@console_ns.route("/apps/<uuid:app_id>/audio-to-text")
class ChatMessageAudioApi(Resource):
@console_ns.doc("chat_message_audio_transcript")
@console_ns.doc(description="Transcript audio to text for chat messages")
@console_ns.doc(
consumes=["multipart/form-data"],
params={"app_id": "App ID", "file": _AUDIO_TRANSCRIPT_FILE_PARAM},
)
@console_ns.response(View on GitHub (pinned to ef8544b173)
Solutions
- Retry the request after a short backoff — many InvokeError causes are transient.
- Verify provider credentials are valid and have credit/quota under Settings -> Model Provider.
- Check the provider's status page for outages.
- Inspect the wrapped e.description in the response for provider-specific detail and address accordingly.
Defensive patterns
Strategy: retry
Try / catch
async function transcribeWithRetry(form, retries = 2) {
for (let i = 0; i <= retries; i++) {
try { return await axios.post(`/apps/${id}/audio-to-text`, form); }
catch (e) {
if (e.code === 'completion_request_error' && i < retries) { await backoff(i); continue; }
throw e;
}
}
} Prevention
- Validate provider credentials and quota before relying on STT.
- Inspect e.description in the response for upstream detail.
- Retry with exponential backoff for transient InvokeError causes.
When it happens
Trigger: Any underlying provider call failure during transcription: transient network error, expired API key, upstream 5xx, model-specific runtime error, or upstream rate limit returned via InvokeError.
Common situations: Provider API key rotated but not updated in Dify; upstream outage; rate-limited provider account; transient connectivity from the Dify node to the provider.
Related errors
- app_unavailable
- unsupported_audio_type
- provider_not_support_speech_to_text
- provider_quota_exceeded
- model_currently_not_support
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/6fd4af1d91eebaa1.
Report an issue: GitHub.