iflytek/astron-agent · error · BusinessException

AUDIO_FILE_SIZE_EXCEEDED

AUDIO_FILE_SIZE_EXCEEDED

Error message

AUDIO_FILE_SIZE_EXCEEDED

What it means

BusinessException(ResponseEnum.AUDIO_FILE_SIZE_EXCEEDED) thrown by AudioValidator.validateFileSize when file.getSize() exceeds MAX_FILE_SIZE_BYTES. The validator enforces a hard upload size cap for audio files before attempting to parse the audio stream.

Solutions

  1. Trim the recording or export a shorter clip below the size limit.
  2. Compress/convert to a smaller format or lower bitrate: ffmpeg -i big.wav -b:a 64k small.mp3.
  3. For WAV, reduce sample rate/bit depth (e.g. 16kHz mono 16-bit) which drastically cuts size.
  4. If the limit is too restrictive for legitimate use, raise MAX_FILE_SIZE_BYTES (and any Spring multipart max-file-size config) on the server.

Example fix

// before: 5-minute WAV too large
upload(recording_5min.wav)
// after: re-encode to compressed mono
// ffmpeg -i recording_5min.wav -ar 16000 -ac 1 -b:a 64k recording_5min.mp3
upload(recording_5min.mp3)
Defensive patterns

Strategy: validation

Validate before calling

if (file.size > MAX_FILE_SIZE_BYTES) { alert(`File exceeds limit of ${MAX_FILE_SIZE_BYTES} bytes`); return; }

Try / catch

try { AudioValidator.validateAudioFile(file); }
catch (BusinessException e) { if (ResponseEnum.AUDIO_FILE_SIZE_EXCEEDED.equals(e.getResponseEnum())) { /* 413: prompt user to compress/trim */ } else { throw e; } }

Prevention

When it happens

Trigger: Uploading an audio file larger than the configured MAX_FILE_SIZE_BYTES limit (e.g. a long recording or high-bitrate wav) to the endpoint guarded by validateAudioFile.

Common situations: Long meeting/voice memos recorded as uncompressed WAV (which grows ~176KB/s at 16-bit 44.1kHz); high sample-rate studio files; batch uploads where users forget the per-file cap; limits lowered by config change making previously-fine files now too large.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/f1768f1822a81525. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/AudioValidator.java:81

     */
    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) {
            return;
        }

        String extension = getFileExtension(filename).toLowerCase();

        try {
            // For WAV and PCM formats, Java Sound API can be used for detailed validation
            if ("wav".equals(extension) || "pcm".equals(extension)) {
                validateWavPcmProperties(file);

View on GitHub (pinned to 5e758547a8)