iflytek/astron-agent · error · BusinessException

8125

8125

Error message

work.flow.dls.upload.failed

What it means

importWorkflow() accepts a YAML workflow file upload. Before parsing, it rejects the request with BusinessException(ResponseEnum.WORKFLOW_DLS_UPLOAD_FAILED) (code 8125) when the file parameter is absent, the upload is empty, or the file exceeds MAX_WORKFLOW_IMPORT_BYTES. This is an upfront upload-validation guard.

Solutions

  1. Attach a non-empty YAML file in the multipart 'file' field of the POST /workflow/import request.
  2. Check the file size against MAX_WORKFLOW_IMPORT_BYTES and split or trim the workflow DSL if it is too large.
  3. Verify the frontend form uses enctype=multipart/form-data and the field name is exactly 'file'.
  4. If legitimate workflows exceed the cap, raise MAX_WORKFLOW_IMPORT_BYTES (and spring.servlet.multipart.max-file-size consistently).

Example fix

// before
curl -X POST /workflow/import

// after
curl -X POST /workflow/import -F "file=@workflow-42.yaml"  # non-empty, under size cap
Defensive patterns

Strategy: validation

Validate before calling

const MAX = 5 * 1024 * 1024; // match MAX_WORKFLOW_IMPORT_BYTES
if (!file || file.size === 0) throw new Error('Select a non-empty YAML file');
if (file.size > MAX) throw new Error(`File exceeds import size limit (${MAX} bytes)`);
if (!file.name.endsWith('.yaml') && !file.name.endsWith('.yml')) throw new Error('YAML file required');

Try / catch

try {
  const form = new FormData();
  form.append('file', file);
  await api.post('/workflow/import', form);
} catch (e) {
  if (e.code === 8125) notify('Upload rejected: file missing, empty, or too large');
  else throw e;
}

Prevention

When it happens

Trigger: POST /workflow/import without a 'file' multipart part, with a zero-byte file, or with a file larger than the configured MAX_WORKFLOW_IMPORT_BYTES limit.

Common situations: User submits the import form without selecting a file; an empty placeholder YAML is uploaded; an exported workflow from another instance exceeds the size cap; multipart resolver max-file-size is fine locally but the app-level byte cap is stricter.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/8ff885251be272f1. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/workflow/WorkflowController.java:496

            throw e;
        } catch (Exception e) {
            log.error("export yaml unexpected error, id={}", id, e);
            throw new BusinessException(ResponseEnum.WORKFLOW_EXPORT_FAILED);
        }
    }

    /**
     * Import workflow from YAML.
     */
    @PostMapping("/import")
    @SpacePreAuth(
            key = "WorkflowController_importWorkflow_POST",
            module = "Workflow",
            point = "Workflow Import",
            description = "Workflow Import")
    public Object importWorkflow(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
        if (file == null || file.isEmpty() || file.getSize() > MAX_WORKFLOW_IMPORT_BYTES) {
            throw new BusinessException(ResponseEnum.WORKFLOW_DLS_UPLOAD_FAILED);
        }
        try (InputStream inputStream = file.getInputStream()) {
            return workflowExportService.importWorkflowFromYaml(inputStream, request);
        } catch (BusinessException e) {
            log.warn("import workflow rejected, filename={}, code={}",
                    file.getOriginalFilename(), e.getCode());
            throw e;
        } catch (Exception e) {
            log.error("import workflow failed, filename={}", file.getOriginalFilename(), e);
            throw new BusinessException(ResponseEnum.WORKFLOW_IMPORT_FAILED);
        }
    }

    // ---------------------- Prompt Comparison (Save/List) ----------------------

    @PostMapping("/save-comparisons")
    public ApiResult<String> saveComparisons(@RequestBody @NotNull List<WorkflowComparisonSaveReq> workflowComparisonReqList) {
        return ApiResult.success(workflowService.saveComparisons(workflowComparisonReqList));

View on GitHub (pinned to 5e758547a8)