alibaba/nacos · error · NacosApiException
PARSING_DATA_FAILED
PARSING_DATA_FAILED
Error message
Failed to read file: ${e.getMessage()} What it means
Thrown by validateAndExtractZipBytes when MultipartFile.getBytes() throws an IOException. This is a server-side I/O failure during the read of an otherwise-valid uploaded file — the file passed null/empty and size checks but could not be fully read into memory.
Source
Thrown at ai/src/main/java/com/alibaba/nacos/ai/utils/SkillRequestUtil.java:399
* @throws NacosException if validation fails or file reading fails
*/
public static byte[] validateAndExtractZipBytes(MultipartFile file) throws NacosException {
if (file == null || file.isEmpty()) {
throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.DATA_EMPTY,
"File is required");
}
long maxUploadBytes = SkillZipParser.resolveMaxUploadBytes();
if (file.getSize() > maxUploadBytes) {
throw new NacosApiException(NacosException.INVALID_PARAM,
ErrorCode.PARAMETER_VALIDATE_ERROR,
"Skill zip size must not exceed "
+ (maxUploadBytes / 1024 / 1024)
+ "MB, current: " + (file.getSize() / 1024 / 1024) + "MB");
}
try {
return file.getBytes();
} catch (IOException e) {
throw new NacosApiException(NacosException.SERVER_ERROR, ErrorCode.PARSING_DATA_FAILED,
"Failed to read file: " + e.getMessage());
}
}
}
View on GitHub (pinned to 9b989acdf1)
Solutions
- Retry the upload — transient I/O errors often resolve on the second attempt.
- Check server disk space in the temp directory (java.io.tmpdir) and ensure it has headroom for multipart uploads.
- If using a reverse proxy (nginx, etc.), verify proxy_read_timeout and client_body_timeout are long enough for large uploads.
- If the error persists, inspect the server's disk health and the multipart configuration (spring.servlet.multipart.location for temp file storage).
Example fix
// before — caller has no retry logic
byte[] bytes = SkillRequestUtil.validateAndExtractZipBytes(file);
// after — retry on transient IOException with a guard
byte[] bytes;
int maxRetries = 3;
for (int attempt = 1; attempt <= maxRetries; attempt++) {
try {
bytes = SkillRequestUtil.validateAndExtractZipBytes(file);
break;
} catch (NacosApiException e) {
if (!ErrorCode.PARSING_DATA_FAILED.equals(e.getErrDetail())
|| attempt == maxRetries) {
throw e;
}
}
} Defensive patterns
Strategy: retry
Validate before calling
// Verify file is readable before calling validateAndExtractZipBytes
try {
if (file == null || file.isEmpty()) {
throw new IllegalArgumentException("File is empty");
}
// Proactive read check is not possible without consuming the stream,
// so rely on retry for transient I/O errors.
} catch (Exception e) {
log.warn("File pre-check failed", e);
} Try / catch
try {
byte[] bytes = SkillRequestUtil.validateAndExtractZipBytes(file);
} catch (NacosApiException e) {
if (ErrorCode.PARSING_DATA_FAILED.equals(e.getErrDetail())) {
log.warn("Transient I/O error reading uploaded file, retrying...", e);
// For HTTP uploads, instruct the client to re-upload
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE)
.body("Failed to read file. Please retry the upload.");
}
throw e;
} Prevention
- Ensure the server temp directory has sufficient free disk space for multipart uploads.
- Set appropriate proxy timeouts (proxy_read_timeout) if behind a reverse proxy.
- Monitor disk space and I/O health on the server.
- For programmatic callers, implement retry with exponential backoff for IOException-based failures.
When it happens
Trigger: POST to a skill upload endpoint where the file passes initial validation (non-null, non-empty, within size limit) but a transient I/O error occurs when reading the file bytes into memory. Causes include temporary file cleanup by the OS, disk read errors, or the client disconnecting mid-upload causing the multipart temp file to become unreadable.
Common situations: Client disconnects during multipart upload leaving a truncated temp file; the server's temp directory runs out of disk space mid-upload; the multipart temp file is cleaned up by another process beforegetBytes() is called; a disk I/O error on the server's storage.
Related errors
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/e4dc5639758e3583.
Report an issue: GitHub.