{"record":{"id":"8ff885251be272f1","repo":"iflytek/astron-agent","slug":"8125-work-flow-dls-upload-failed","errorCode":"8125","errorMessage":"work.flow.dls.upload.failed","messagePattern":"work\\.flow\\.dls\\.upload\\.failed","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/workflow/WorkflowController.java","lineNumber":496,"sourceCode":"            throw e;\n        } catch (Exception e) {\n            log.error(\"export yaml unexpected error, id={}\", id, e);\n            throw new BusinessException(ResponseEnum.WORKFLOW_EXPORT_FAILED);\n        }\n    }\n\n    /**\n     * Import workflow from YAML.\n     */\n    @PostMapping(\"/import\")\n    @SpacePreAuth(\n            key = \"WorkflowController_importWorkflow_POST\",\n            module = \"Workflow\",\n            point = \"Workflow Import\",\n            description = \"Workflow Import\")\n    public Object importWorkflow(@RequestParam(\"file\") MultipartFile file, HttpServletRequest request) {\n        if (file == null || file.isEmpty() || file.getSize() > MAX_WORKFLOW_IMPORT_BYTES) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_DLS_UPLOAD_FAILED);\n        }\n        try (InputStream inputStream = file.getInputStream()) {\n            return workflowExportService.importWorkflowFromYaml(inputStream, request);\n        } catch (BusinessException e) {\n            log.warn(\"import workflow rejected, filename={}, code={}\",\n                    file.getOriginalFilename(), e.getCode());\n            throw e;\n        } catch (Exception e) {\n            log.error(\"import workflow failed, filename={}\", file.getOriginalFilename(), e);\n            throw new BusinessException(ResponseEnum.WORKFLOW_IMPORT_FAILED);\n        }\n    }\n\n    // ---------------------- Prompt Comparison (Save/List) ----------------------\n\n    @PostMapping(\"/save-comparisons\")\n    public ApiResult<String> saveComparisons(@RequestBody @NotNull List<WorkflowComparisonSaveReq> workflowComparisonReqList) {\n        return ApiResult.success(workflowService.saveComparisons(workflowComparisonReqList));","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/workflow/WorkflowController.java#L478-L514","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Attach a non-empty YAML file in the multipart 'file' field of the POST /workflow/import request.","Check the file size against MAX_WORKFLOW_IMPORT_BYTES and split or trim the workflow DSL if it is too large.","Verify the frontend form uses enctype=multipart/form-data and the field name is exactly 'file'.","If legitimate workflows exceed the cap, raise MAX_WORKFLOW_IMPORT_BYTES (and spring.servlet.multipart.max-file-size consistently)."],"exampleFix":"// before\ncurl -X POST /workflow/import\n\n// after\ncurl -X POST /workflow/import -F \"file=@workflow-42.yaml\"  # non-empty, under size cap","handlingStrategy":"validation","validationCode":"const MAX = 5 * 1024 * 1024; // match MAX_WORKFLOW_IMPORT_BYTES\nif (!file || file.size === 0) throw new Error('Select a non-empty YAML file');\nif (file.size > MAX) throw new Error(`File exceeds import size limit (${MAX} bytes)`);\nif (!file.name.endsWith('.yaml') && !file.name.endsWith('.yml')) throw new Error('YAML file required');","typeGuard":null,"tryCatchPattern":"try {\n  const form = new FormData();\n  form.append('file', file);\n  await api.post('/workflow/import', form);\n} catch (e) {\n  if (e.code === 8125) notify('Upload rejected: file missing, empty, or too large');\n  else throw e;\n}","preventionTips":["Disable the import submit button until a non-empty file under the size cap is selected.","Keep the client-side size limit in sync with MAX_WORKFLOW_IMPORT_BYTES.","Use the exact multipart field name 'file' and enctype=multipart/form-data."],"tags":["import","file-upload","validation","multipart","java"],"backgroundTag":"payload-too-large","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}