iflytek/astron-agent · warning · BusinessException

8130

8130

Error message

workflow.artifact.file.too.large

What it means

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.

Solutions

  1. Compress or reduce the file so it fits within artifactMaxFileSize, or upload a smaller file.
  2. Increase the limit via the skill-sandbox artifact config (artifactMaxFileSize) and also raise spring.servlet.multipart.max-file-size/max-request-size accordingly.
  3. Check file.getSize() client-side before upload and reject oversized files early.
  4. If 0-byte, re-export/re-upload the file — an empty file cannot pass validation.

Example fix

// before
// skill-sandbox.artifact-max-file-size unset -> tiny default limit -> 8130
// after (application.yml)
skill:
  sandbox:
    artifact-max-file-size: 20MB
spring:
  servlet:
    multipart:
      max-file-size: 25MB
      max-request-size: 30MB
Defensive patterns

Strategy: validation

Validate before calling

long maxBytes = properties.getArtifactMaxFileSize().toBytes();
boolean withinLimit = file != null && file.getSize() > 0 && file.getSize() <= maxBytes;

Try / catch

try {
    validator.validate(file);
} catch (BusinessException e) {
    if (e.getCode() == 8130) {
        // show user the configured max size and ask for a smaller file
    }
}

Prevention

When it happens

Trigger: Uploading a file whose byte size exceeds SkillSandboxArtifactProperties.artifactMaxFileSize; an empty (0-byte) file also lands here because size <= 0 is treated as invalid.

Common situations: 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.

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/b85755a16e2440b1. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactFileValidator.java:134

                        MAX_OOXML_ENTRY_COUNT,
                        MAX_OOXML_ENTRY_BYTES,
                        MAX_OOXML_XML_ENTRY_BYTES,
                        MAX_OOXML_CONTROL_XML_ENTRY_BYTES,
                        MAX_OOXML_TOTAL_EXPANDED_BYTES));
    }

    WorkflowArtifactFileValidator(
            SkillSandboxArtifactProperties properties, OoxmlResourceLimits ooxmlResourceLimits) {
        this.properties = Objects.requireNonNull(properties);
        this.ooxmlResourceLimits = Objects.requireNonNull(ooxmlResourceLimits);
    }

    public ValidatedArtifact validate(MultipartFile file) {
        if (file == null || file.isEmpty() || StringUtils.isBlank(file.getOriginalFilename())) {
            throw new BusinessException(ResponseEnum.PARAM_ERROR);
        }
        if (file.getSize() <= 0 || file.getSize() > properties.getArtifactMaxFileSize().toBytes()) {
            throw new BusinessException(ResponseEnum.WORKFLOW_ARTIFACT_FILE_TOO_LARGE);
        }

        String fileName = normalizeFileName(file.getOriginalFilename());
        String extension = StringUtils.lowerCase(FilenameUtils.getExtension(fileName), Locale.ROOT);
        Set<String> configuredExtensions = properties.getArtifactAllowedExtensions();
        if (StringUtils.isBlank(extension)
                || configuredExtensions.stream().noneMatch(extension::equalsIgnoreCase)
                || !MEDIA_TYPES_BY_EXTENSION.containsKey(extension)) {
            throw new BusinessException(ResponseEnum.WORKFLOW_ARTIFACT_FILE_TYPE_NOT_ALLOWED);
        }

        String declaredType = normalizeMediaType(file.getContentType());
        if (ACTIVE_CONTENT_TYPES.contains(declaredType)
                || (!StringUtils.isBlank(declaredType)
                        && !OCTET_STREAM.equals(declaredType)
                        && !MEDIA_TYPES_BY_EXTENSION.get(extension).contains(declaredType))) {
            throw new BusinessException(ResponseEnum.WORKFLOW_ARTIFACT_CONTENT_TYPE_MISMATCH);
        }

View on GitHub (pinned to 5e758547a8)