iflytek/astron-agent · error · BusinessException

PARAM_ERROR

PARAM_ERROR

Error message

PARAM_ERROR

What it means

BusinessException(ResponseEnum.PARAM_ERROR) thrown by validateBasicAudioProperties when the uploaded file is smaller than 1024 bytes (1KB). The validator treats sub-1KB audio as unreasonably small — likely corrupt, truncated, or not real audio — and rejects it as a parameter error even though format and size caps already passed.

Solutions

  1. Re-upload the complete original audio file — verify locally it is larger than 1KB.
  2. Check the source file integrity (play it locally) to confirm it is not truncated or corrupt.
  3. Re-export/re-record the audio; ensure the recording actually captured samples.
  4. Compare file sizes before and after transfer (checksum/size) to detect truncation in transit.

Example fix

// before: truncated file slipped through
const bytes = fs.readFileSync('truncated.wav'); // 512 bytes
upload(bytes);
// after: guard before sending
if (bytes.length < 1024) throw new Error('audio file too small/truncated');
upload(bytes);
Defensive patterns

Strategy: validation

Validate before calling

if (file.size < 1024) { alert('Audio file is too small or truncated'); return; }

Type guard

boolean plausiblyRealAudio(MultipartFile f) { return f != null && f.getSize() >= 1024; }

Try / catch

try { AudioValidator.validateAudioProperties(file); }
catch (BusinessException e) { if (ResponseEnum.PARAM_ERROR.equals(e.getResponseEnum())) { /* 400: re-upload a complete file */ } else { throw e; } }

Prevention

When it happens

Trigger: Uploading an audio file whose file.getSize() < 1024 bytes — e.g. a truncated download, a near-empty wav header-only file, or a tiny placeholder file — through validateAudioProperties during audio upload.

Common situations: Interrupted uploads that only transferred the file header; files truncated by editors or transfer tools; placeholder/zero-ish-byte files renamed to .wav; clients generating audio buffers that never got real samples written.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

        // 40 seconds of audio is approximately 1.92MB, leaving some margin
        long estimatedMaxSizeForDuration = (long) (MAX_DURATION_SECONDS * 48000 * 1.5);

        if (fileSize > estimatedMaxSizeForDuration) {
            log.warn("Audio file size {} exceeds expected, may be too long", fileSize);
            // Do not throw exception because this is only a rough estimate
        }
    }

    /**
     * Validate basic audio properties (used when audio format cannot be parsed)
     */
    private static void validateBasicAudioProperties(MultipartFile file) throws BusinessException {
        // Basic validation: file size reasonableness check
        long fileSize = file.getSize();

        // Ensure file is not too small (at least 1KB)
        if (fileSize < 1024) {
            throw new BusinessException(ResponseEnum.PARAM_ERROR);
        }

        log.info("Audio file passed basic validation, filename: {}, size: {} bytes", file.getOriginalFilename(), fileSize);
    }

    /**
     * Get file extension
     */
    private static String getFileExtension(String filename) {
        int lastDotIndex = filename.lastIndexOf('.');
        if (lastDotIndex == -1 || lastDotIndex == filename.length() - 1) {
            return "";
        }
        return filename.substring(lastDotIndex + 1);
    }
}

View on GitHub (pinned to 5e758547a8)