iflytek/astron-agent · error · BusinessException
AUDIO_FILE_FORMAT_UNSUPPORTED
AUDIO_FILE_FORMAT_UNSUPPORTED
Error message
AUDIO_FILE_FORMAT_UNSUPPORTED
What it means
BusinessException(ResponseEnum.AUDIO_FILE_FORMAT_UNSUPPORTED) thrown by AudioValidator.validateFileFormat when the file extension (lowercased) is not in SUPPORTED_FORMATS. The validator whitelists audio container formats before doing deeper audio-property validation, so anything outside the whitelist is rejected immediately.
Solutions
- Convert the audio to a supported format (wav/mp3/m4a per SUPPORTED_FORMATS) with ffmpeg: ffmpeg -i input.ogg output.wav.
- Ensure the file has the correct, matching extension for its actual format.
- Check SUPPORTED_FORMATS in AudioValidator to confirm which extensions are accepted for this endpoint.
- Do not simply rename the extension — re-encode the file so container and extension agree.
Example fix
// before: rejected upload upload(file="voice_note.ogg") // after: convert to supported format first // ffmpeg -i voice_note.ogg voice_note.wav upload(file="voice_note.wav")
Defensive patterns
Strategy: validation
Validate before calling
const ok = ['wav','mp3','m4a'].includes(file.name.split('.').pop().toLowerCase());
if (!ok) { alert('Unsupported format; convert to wav/mp3/m4a'); return; } Type guard
boolean isSupportedAudio(String filename) { String ext = extensionOf(filename); return ext != null && SUPPORTED_FORMATS.contains(ext.toLowerCase()); } Try / catch
try { AudioValidator.validateAudioFile(file); }
catch (BusinessException e) { if (ResponseEnum.AUDIO_FILE_FORMAT_UNSUPPORTED.equals(e.getResponseEnum())) { /* 415: tell user to convert format */ } else { throw e; } } Prevention
- Filter by accepted extensions in the file picker (accept=".wav,.mp3,.m4a").
- Show the supported-format list to users before upload.
- Re-encode with ffmpeg rather than renaming extensions.
- Keep server SUPPORTED_FORMATS list documented and mirrored client-side.
When it happens
Trigger: Uploading audio whose extension is not in the supported set — e.g. .ogg, .flac, .aac, .webm, or a file with no/misnamed extension — into the audio upload endpoint validated by validateAudioFile.
Common situations: Users uploading recordings saved by apps that default to ogg/webm; files renamed without converting (renaming .mp3 to .wav does not convert); extensionless downloads; uppercase or double extensions (.WAV.bak) that fail the whitelist.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/c5c6779ce97fbd14.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/AudioValidator.java:72
// 2. Check file size
validateFileSize(file);
// 3. Check audio properties
validateAudioProperties(file);
}
/**
* Validate file format
*/
private static void validateFileFormat(MultipartFile file) throws BusinessException {
String filename = file.getOriginalFilename();
if (filename == null) {
throw new BusinessException(ResponseEnum.PARAM_MISS);
}
String extension = getFileExtension(filename).toLowerCase();
if (!SUPPORTED_FORMATS.contains(extension)) {
throw new BusinessException(ResponseEnum.AUDIO_FILE_FORMAT_UNSUPPORTED);
}
}
/**
* Validate file size
*/
private static void validateFileSize(MultipartFile file) throws BusinessException {
if (file.getSize() > MAX_FILE_SIZE_BYTES) {
throw new BusinessException(ResponseEnum.AUDIO_FILE_SIZE_EXCEEDED);
}
}
/**
* Validate audio properties
*/
private static void validateAudioProperties(MultipartFile file) throws BusinessException {
String filename = file.getOriginalFilename();
if (filename == null) {View on GitHub (pinned to 5e758547a8)