{"record":{"id":"2f4fe2e958b5f0f8","repo":"iflytek/astron-agent","slug":"8005-param-error-2f4fe2","errorCode":"8005","errorMessage":"param.error","messagePattern":"param\\.error","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":131,"sourceCode":"        this(\n                properties,\n                new OoxmlResourceLimits(\n                        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)","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactFileValidator.java#L113-L149","documentation":"WorkflowArtifactFileValidator.validate performs the first sanity check on an uploaded workflow artifact: the MultipartFile must be present, non-empty, and carry an original filename. Otherwise it throws BusinessException(ResponseEnum.PARAM_ERROR, code 8005). It means the upload request was malformed before any content inspection could run.","triggerScenarios":"Calling the artifact upload endpoint without a file part; a zero-byte file; a multipart part whose originalFilename is blank (some clients omit the filename in Content-Disposition).","commonSituations":"Frontend form field name mismatch so Spring binds no file; user submits the form before the file finishes selecting; programmatic curl/upload without -F filename=...; a proxy stripping the filename attribute.","solutions":["Ensure the multipart field name matches the controller parameter and the client actually attaches a file.","Check that the selected file is non-empty before submitting.","Send a proper Content-Disposition with a filename (e.g. curl -F \"file=@doc.docx\" instead of -F \"file=@\").","Return 8005 to the client and prompt re-selection of the file."],"exampleFix":"// before\ncurl -X POST .../artifacts -F \"file=\"           // empty -> 8005\n// after\ncurl -X POST .../artifacts -F \"file=@report.docx\"","handlingStrategy":"validation","validationCode":"boolean validUpload = file != null && !file.isEmpty()\n        && StringUtils.isNotBlank(file.getOriginalFilename());\nif (!validUpload) throw new BusinessException(ResponseEnum.PARAM_ERROR);","typeGuard":null,"tryCatchPattern":"try {\n    validator.validate(file);\n} catch (BusinessException e) {\n    if (e.getCode() == 8005) {\n        // return 400 with 'missing or empty file' message to the client\n    }\n}","preventionTips":["Match the multipart field name to the controller parameter.","Disable submit until a file is selected and file.size > 0.","Always include a filename in Content-Disposition when uploading programmatically."],"tags":["upload","multipart","validation","param"],"backgroundTag":"null-argument","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"}