iflytek/astron-agent · warning · BusinessException
WORKFLOW_ARTIFACT_FILE_TOO_LARGE
WORKFLOW_ARTIFACT_FILE_TOO_LARGE
Error message
WORKFLOW_ARTIFACT_FILE_TOO_LARGE
What it means
copyToTemporaryFile enforces the configured per-file size limit (properties.getArtifactMaxFileSize) byte-by-byte while streaming the MultipartFile to a temp file before OOXML parsing. If the copied byte count exceeds the limit it throws WORKFLOW_ARTIFACT_FILE_TOO_LARGE. This second check exists because the earlier file.getSize() check can be bypassed or diverge for certain multipart implementations.
Solutions
- Reduce the file size or split the document; strip large embedded media/images from the Office file.
- Raise SkillSandboxArtifactProperties.artifactMaxFileSize to accommodate legitimate documents (also ensure Spring's spring.servlet.multipart.max-file-size and any proxy body limits are raised consistently).
- Verify the reported size: compare file.getSize() with actual bytes to catch multipart-layer misreporting.
Example fix
// before artifact.max-file-size=10MB // after artifact.max-file-size=50MB # plus spring.servlet.multipart.max-file-size=50MB
Defensive patterns
Strategy: validation
Validate before calling
long maxBytes = properties.getArtifactMaxFileSize().toBytes();
if (file.getSize() <= 0 || file.getSize() > maxBytes) { /* reject before validate() */ }
// and client-side: check file.size before upload Try / catch
try { validator.validate(file); } catch (BusinessException e) { /* map to HTTP 413 with the configured limit in the message */ } Prevention
- Check file size in the browser/client before upload and show the limit in the UI.
- Keep spring.servlet.multipart.max-file-size, proxy body limits, and artifactMaxFileSize aligned.
- Strip large embedded media from Office documents to shrink them.
When it happens
Trigger: validate() (via validateOoxmlContainer) called with an Office document whose streamed content exceeds artifactMaxFileSize even though file.getSize() passed — e.g. size reported incorrectly by the multipart layer, or the limit lowered by config between the size check and the copy.
Common situations: artifactMaxFileSize configured below actual large xlsx/docx files; multipart parsers that misreport size; requests that passed a proxy-level limit but not the application-level one.
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/93ce17c1f80c0ede.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactFileValidator.java:225
}
}
}
private Path copyToTemporaryFile(MultipartFile file) throws IOException {
Path temporaryFile = Files.createTempFile("astron-workflow-artifact-", ".ooxml");
boolean completed = false;
try (InputStream input = file.getInputStream();
OutputStream output = Files.newOutputStream(
temporaryFile,
StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING)) {
byte[] buffer = new byte[COPY_BUFFER_SIZE];
long copied = 0;
int read;
while ((read = input.read(buffer)) != -1) {
copied += read;
if (copied > properties.getArtifactMaxFileSize().toBytes()) {
throw new BusinessException(ResponseEnum.WORKFLOW_ARTIFACT_FILE_TOO_LARGE);
}
output.write(buffer, 0, read);
}
completed = true;
return temporaryFile;
} finally {
if (!completed) {
Files.deleteIfExists(temporaryFile);
}
}
}
/**
* Reads every archive entry through POI's zip-bomb-aware stream before OPC parsing. POI only
* exposes JVM-global limits, so per-upload absolute limits are enforced here as well to avoid
* changing the behavior of unrelated Excel import paths in the same application.
*/
void validateOoxmlResourceLimits(Path file) throws IOException {View on GitHub (pinned to 5e758547a8)