iflytek/astron-agent · error · BusinessException
PARAM_MISS
PARAM_MISS
Error message
PARAM_MISS
What it means
BusinessException(ResponseEnum.PARAM_MISS) thrown by AudioValidator.validateFileFormat when file.getOriginalFilename() returns null. Without an original filename the validator cannot derive the extension, so format checking is impossible and the request is rejected as missing a required parameter.
Solutions
- Set a filename on the multipart part (Content-Disposition: form-data; name="file"; filename="audio.wav").
- In curl, use -F "file=@recording.wav" instead of piping raw bytes, so a filename is transmitted.
- If constructing a MultipartFile in tests/code, pass a real filename: new MockMultipartFile("file", "audio.wav", "audio/wav", bytes).
- Check any intermediary proxy is not stripping the filename from the multipart headers.
Example fix
// before: no filename in the part
body.append("--\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n").append(bytes);
// after
body.append("--\r\nContent-Disposition: form-data; name=\"file\"; filename=\"audio.wav\"\r\nContent-Type: audio/wav\r\n\r\n").append(bytes); Defensive patterns
Strategy: validation
Validate before calling
String name = file.getOriginalFilename();
if (name == null || name.lastIndexOf('.') < 0) { alert('File must have a filename with extension'); return; } Type guard
boolean hasFilename(MultipartFile f) { String n = f == null ? null : f.getOriginalFilename(); return n != null && !n.isBlank(); } Try / catch
try { AudioValidator.validateAudioFile(file); }
catch (BusinessException e) { if (ResponseEnum.PARAM_MISS.equals(e.getResponseEnum())) { /* 400: request missing filename metadata */ } else { throw e; } } Prevention
- Always send multipart parts with a filename attribute (curl -F "file=@x.wav").
- Use standard HTTP client libraries rather than hand-rolled multipart bodies.
- In tests, construct MockMultipartFile with a real filename.
- Verify proxies don't strip Content-Disposition headers.
When it happens
Trigger: Uploading a Multipart whose part carries no filename — e.g. a client sending the file bytes without a filename attribute in the Content-Disposition header, or programmatic MockMultipartFile/ByteArrayMultipartFile constructed without a filename.
Common situations: Custom HTTP clients or scripts that omit filename in the multipart part; proxies/gateways that strip Content-Disposition metadata; unit tests constructing MultipartFile with a null name; browsers with unusual form encodings.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/beeec016b8643b7c.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/AudioValidator.java:67
}
// 1. Check file format
validateFileFormat(file);
// 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);
}
}
/**View on GitHub (pinned to 5e758547a8)