langgenius/dify · error · NoAudioUploadedError

no_audio_uploaded

no_audio_uploaded

Error message

Please upload your audio.

What it means

Raised by _transcribe_audio_to_text when AudioService raises NoAudioUploadedServiceError — the multipart request had no usable audio file under 'file' (missing or empty). Translated to NoAudioUploadedError (400, error_code 'no_audio_uploaded'). The console audio endpoint reads request.files.get('file') which can be None.

Source

Thrown at api/controllers/console/app/audio.py:155

                app_model=app_model,
                file=file,
                session=session,
                end_user=None,
            )
        else:
            response = AudioService.transcript_agent_asr(
                app_model=app_model,
                agent_soul=agent_soul,
                file=file,
                session=session,
                end_user=None,
            )
        return dump_response(AudioTranscriptResponse, 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 HTTPException:
        raise

View on GitHub (pinned to ef8544b173)

Solutions

  1. Attach the audio under the 'file' field as multipart/form-data.
  2. Confirm the recording actually produced bytes before submitting (check Blob.size > 0).
  3. Verify the request Content-Type is multipart/form-data, not application/json.
  4. Make the UI disable submit until a non-empty recording exists.

Example fix

// before
form.append('audio', blob);

// after
form.append('file', blob, 'message.mp3');
Defensive patterns

Strategy: validation

Validate before calling

function buildAudioForm(blob) {
  if (!blob || blob.size === 0) throw new Error('A non-empty audio file is required');
  const form = new FormData();
  form.append('file', blob, 'message.mp3');
  return form;
}

Type guard

const isNonEmptyAudioBlob = (b) => !!b && typeof b.size === 'number' && b.size > 0;

Try / catch

try { await axios.post(`/apps/${id}/audio-to-text`, form); }
catch (e) { if (e.code === 'no_audio_uploaded') alert('Record or attach audio first.'); }

Prevention

When it happens

Trigger: POST /console/apps/{app_id}/audio-to-text (or /agent/{agent_id}/audio-to-text) without a 'file' part, or with an empty file. The file argument passed to the service is None or empty.

Common situations: Frontend sends the audio Blob under the wrong field name; recorder library produced no data; form submitted before the recording finished; cURL request omitted the -F file part.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/742056c591cfa825. Report an issue: GitHub.