{"record":{"id":"98ef7fe5929aafe0","repo":"iflytek/astron-agent","slug":"param-error-98ef7f","errorCode":"PARAM_ERROR","errorMessage":"PARAM_ERROR","messagePattern":"PARAM_ERROR","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactService.java","lineNumber":365,"sourceCode":"                    file.getSize(),\n                    validatedArtifact.contentType());\n            return dto;\n        } catch (RuntimeException exception) {\n            boolean removed = s3ClientUtil.removeObject(\n                    artifactProperties.getArtifactBucket(), objectKey);\n            if (!removed) {\n                log.error(\n                        \"Failed to compensate workflow artifact upload, bucket={}, objectKey={}\",\n                        artifactProperties.getArtifactBucket(),\n                        objectKey);\n            }\n            throw exception;\n        }\n    }\n\n    private WorkflowArtifact getScopedArtifact(Long artifactId) {\n        if (artifactId == null) {\n            throw new BusinessException(ResponseEnum.PARAM_ERROR);\n        }\n        LambdaQueryWrapper<WorkflowArtifact> wrapper = Wrappers.lambdaQuery(WorkflowArtifact.class)\n                .eq(WorkflowArtifact::getId, artifactId)\n                .eq(WorkflowArtifact::getDeleted, Boolean.FALSE);\n        applyCurrentArtifactScope(wrapper);\n        WorkflowArtifact artifact = getOne(wrapper, false);\n        if (artifact == null) {\n            throw new BusinessException(ResponseEnum.DATA_NOT_EXIST);\n        }\n        return artifact;\n    }\n\n    private LambdaQueryWrapper<WorkflowArtifact> scopeQuery(Long workflowId) {\n        LambdaQueryWrapper<WorkflowArtifact> wrapper = Wrappers.lambdaQuery(WorkflowArtifact.class)\n                .eq(WorkflowArtifact::getWorkflowId, workflowId)\n                .eq(WorkflowArtifact::getDeleted, Boolean.FALSE);\n        applyCurrentArtifactScope(wrapper);\n        return wrapper;","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactService.java#L347-L383","documentation":"getScopedArtifact throws PARAM_ERROR when the artifactId argument is null. Before any query is built, the method rejects a missing identifier; callers such as artifact(artifactId) pass the path/query parameter straight through, so an absent or unset ID reaches this guard. It is a fail-fast parameter validation, not a lookup miss (that would be DATA_NOT_EXIST).","triggerScenarios":"Calling the artifact get/delete API without supplying artifactId (null path variable, missing query param, or a client passing null into WorkflowArtifactService.artifact(null)).","commonSituations":"Frontend bug where the artifact ID is undefined at call time; template/URL placeholder not substituted; deserialization producing null for a malformed request body.","solutions":["Ensure the client always sends a non-null artifactId; log/validate it at the controller layer","Add a @NotNull/@Positive validation on the controller parameter so a clear 400 is returned before the service","Fix the calling code that resolves the ID (e.g. from a list selection) so it never passes undefined"],"exampleFix":"// before\nartifactService.artifact(params.get(\"artifactId\")); // may be null\n// after\nLong id = params.get(\"artifactId\");\nif (id == null) { throw new BadRequestException(\"artifactId is required\"); }\nartifactService.artifact(id);","handlingStrategy":"validation","validationCode":"// Validate the ID before calling the API\nif (artifactId == null || artifactId <= 0)\n    throw new IllegalArgumentException(\"artifactId is required and must be positive\");","typeGuard":"boolean hasArtifactId(Map<String, Object> params) {\n    Object id = params.get(\"artifactId\");\n    return id instanceof Long && ((Long) id) > 0;\n}","tryCatchPattern":"try {\n    artifactApi.get(artifactId);\n} catch (BusinessException e) {\n    if (\"PARAM_ERROR\".equals(e.getCode())) {\n        throw new ClientInputException(\"Missing artifactId — check request parameters\", e);\n    }\n    throw e;\n}","preventionTips":["Annotate controller params with @NotNull/@Positive for early 400s","Validate URL template substitution in clients (no unresolved placeholders)","Fail fast in frontend code when an artifact ID is undefined instead of sending the request"],"tags":["java","validation","null","api","workflow-artifact"],"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"}