{"record":{"id":"beeec016b8643b7c","repo":"iflytek/astron-agent","slug":"param-miss","errorCode":"PARAM_MISS","errorMessage":"PARAM_MISS","messagePattern":"PARAM_MISS","errorType":"validation","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/AudioValidator.java","lineNumber":67,"sourceCode":"        }\n\n        // 1. Check file format\n        validateFileFormat(file);\n\n        // 2. Check file size\n        validateFileSize(file);\n\n        // 3. Check audio properties\n        validateAudioProperties(file);\n    }\n\n    /**\n     * Validate file format\n     */\n    private static void validateFileFormat(MultipartFile file) throws BusinessException {\n        String filename = file.getOriginalFilename();\n        if (filename == null) {\n            throw new BusinessException(ResponseEnum.PARAM_MISS);\n        }\n\n        String extension = getFileExtension(filename).toLowerCase();\n        if (!SUPPORTED_FORMATS.contains(extension)) {\n            throw new BusinessException(ResponseEnum.AUDIO_FILE_FORMAT_UNSUPPORTED);\n        }\n    }\n\n    /**\n     * Validate file size\n     */\n    private static void validateFileSize(MultipartFile file) throws BusinessException {\n        if (file.getSize() > MAX_FILE_SIZE_BYTES) {\n            throw new BusinessException(ResponseEnum.AUDIO_FILE_SIZE_EXCEEDED);\n        }\n    }\n\n    /**","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/AudioValidator.java#L49-L85","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: no filename in the part\nbody.append(\"--\\r\\nContent-Disposition: form-data; name=\\\"file\\\"\\r\\n\\r\\n\").append(bytes);\n// after\nbody.append(\"--\\r\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"audio.wav\\\"\\r\\nContent-Type: audio/wav\\r\\n\\r\\n\").append(bytes);","handlingStrategy":"validation","validationCode":"String name = file.getOriginalFilename();\nif (name == null || name.lastIndexOf('.') < 0) { alert('File must have a filename with extension'); return; }","typeGuard":"boolean hasFilename(MultipartFile f) { String n = f == null ? null : f.getOriginalFilename(); return n != null && !n.isBlank(); }","tryCatchPattern":"try { AudioValidator.validateAudioFile(file); }\ncatch (BusinessException e) { if (ResponseEnum.PARAM_MISS.equals(e.getResponseEnum())) { /* 400: request missing filename metadata */ } else { throw e; } }","preventionTips":["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."],"tags":["java","upload","multipart","missing-parameter"],"backgroundTag":"missing-required-argument","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}