{"record":{"id":"b85755a16e2440b1","repo":"iflytek/astron-agent","slug":"8130-workflow-artifact-file-too-large","errorCode":"8130","errorMessage":"workflow.artifact.file.too.large","messagePattern":"workflow\\.artifact\\.file\\.too\\.large","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactFileValidator.java","lineNumber":134,"sourceCode":"                        MAX_OOXML_ENTRY_COUNT,\n                        MAX_OOXML_ENTRY_BYTES,\n                        MAX_OOXML_XML_ENTRY_BYTES,\n                        MAX_OOXML_CONTROL_XML_ENTRY_BYTES,\n                        MAX_OOXML_TOTAL_EXPANDED_BYTES));\n    }\n\n    WorkflowArtifactFileValidator(\n            SkillSandboxArtifactProperties properties, OoxmlResourceLimits ooxmlResourceLimits) {\n        this.properties = Objects.requireNonNull(properties);\n        this.ooxmlResourceLimits = Objects.requireNonNull(ooxmlResourceLimits);\n    }\n\n    public ValidatedArtifact validate(MultipartFile file) {\n        if (file == null || file.isEmpty() || StringUtils.isBlank(file.getOriginalFilename())) {\n            throw new BusinessException(ResponseEnum.PARAM_ERROR);\n        }\n        if (file.getSize() <= 0 || file.getSize() > properties.getArtifactMaxFileSize().toBytes()) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_ARTIFACT_FILE_TOO_LARGE);\n        }\n\n        String fileName = normalizeFileName(file.getOriginalFilename());\n        String extension = StringUtils.lowerCase(FilenameUtils.getExtension(fileName), Locale.ROOT);\n        Set<String> configuredExtensions = properties.getArtifactAllowedExtensions();\n        if (StringUtils.isBlank(extension)\n                || configuredExtensions.stream().noneMatch(extension::equalsIgnoreCase)\n                || !MEDIA_TYPES_BY_EXTENSION.containsKey(extension)) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_ARTIFACT_FILE_TYPE_NOT_ALLOWED);\n        }\n\n        String declaredType = normalizeMediaType(file.getContentType());\n        if (ACTIVE_CONTENT_TYPES.contains(declaredType)\n                || (!StringUtils.isBlank(declaredType)\n                        && !OCTET_STREAM.equals(declaredType)\n                        && !MEDIA_TYPES_BY_EXTENSION.get(extension).contains(declaredType))) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_ARTIFACT_CONTENT_TYPE_MISMATCH);\n        }","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactFileValidator.java#L116-L152","documentation":"WorkflowArtifactFileValidator.validate enforces the configured artifact size limit (properties.getArtifactMaxFileSize()). Files with size <= 0 or larger than the configured maximum throw BusinessException(ResponseEnum.WORKFLOW_ARTIFACT_FILE_TOO_LARGE, code 8130). It means the uploaded artifact violates the platform's file-size policy for workflow skill artifacts.","triggerScenarios":"Uploading a file whose byte size exceeds SkillSandboxArtifactProperties.artifactMaxFileSize; an empty (0-byte) file also lands here because size <= 0 is treated as invalid.","commonSituations":"Server raised the limit but the client sends pre-compressed/large media; user tries to attach a video or large PDF as an artifact; misconfigured spring multipart max-file-size smaller than needed so Spring delivers a truncated/empty part; limit changed between environments.","solutions":["Compress or reduce the file so it fits within artifactMaxFileSize, or upload a smaller file.","Increase the limit via the skill-sandbox artifact config (artifactMaxFileSize) and also raise spring.servlet.multipart.max-file-size/max-request-size accordingly.","Check file.getSize() client-side before upload and reject oversized files early.","If 0-byte, re-export/re-upload the file — an empty file cannot pass validation."],"exampleFix":"// before\n// skill-sandbox.artifact-max-file-size unset -> tiny default limit -> 8130\n// after (application.yml)\nskill:\n  sandbox:\n    artifact-max-file-size: 20MB\nspring:\n  servlet:\n    multipart:\n      max-file-size: 25MB\n      max-request-size: 30MB","handlingStrategy":"validation","validationCode":"long maxBytes = properties.getArtifactMaxFileSize().toBytes();\nboolean withinLimit = file != null && file.getSize() > 0 && file.getSize() <= maxBytes;","typeGuard":null,"tryCatchPattern":"try {\n    validator.validate(file);\n} catch (BusinessException e) {\n    if (e.getCode() == 8130) {\n        // show user the configured max size and ask for a smaller file\n    }\n}","preventionTips":["Expose the configured limit to the frontend and check file.size before upload.","Keep artifactMaxFileSize and spring.servlet.multipart.max-file-size consistent.","Strip or warn on oversized media before it reaches the API."],"tags":["upload","file-size","limit","validation"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}