iflytek/astron-agent · error · BusinessException

PARAM_ERROR

PARAM_ERROR

Error message

PARAM_ERROR

What it means

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).

Solutions

  1. Ensure the client always sends a non-null artifactId; log/validate it at the controller layer
  2. Add a @NotNull/@Positive validation on the controller parameter so a clear 400 is returned before the service
  3. Fix the calling code that resolves the ID (e.g. from a list selection) so it never passes undefined

Example fix

// before
artifactService.artifact(params.get("artifactId")); // may be null
// after
Long id = params.get("artifactId");
if (id == null) { throw new BadRequestException("artifactId is required"); }
artifactService.artifact(id);
Defensive patterns

Strategy: validation

Validate before calling

// Validate the ID before calling the API
if (artifactId == null || artifactId <= 0)
    throw new IllegalArgumentException("artifactId is required and must be positive");

Type guard

boolean hasArtifactId(Map<String, Object> params) {
    Object id = params.get("artifactId");
    return id instanceof Long && ((Long) id) > 0;
}

Try / catch

try {
    artifactApi.get(artifactId);
} catch (BusinessException e) {
    if ("PARAM_ERROR".equals(e.getCode())) {
        throw new ClientInputException("Missing artifactId — check request parameters", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling the artifact get/delete API without supplying artifactId (null path variable, missing query param, or a client passing null into WorkflowArtifactService.artifact(null)).

Common situations: Frontend bug where the artifact ID is undefined at call time; template/URL placeholder not substituted; deserialization producing null for a malformed request body.

Related errors


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

Appendix: source

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

                    file.getSize(),
                    validatedArtifact.contentType());
            return dto;
        } catch (RuntimeException exception) {
            boolean removed = s3ClientUtil.removeObject(
                    artifactProperties.getArtifactBucket(), objectKey);
            if (!removed) {
                log.error(
                        "Failed to compensate workflow artifact upload, bucket={}, objectKey={}",
                        artifactProperties.getArtifactBucket(),
                        objectKey);
            }
            throw exception;
        }
    }

    private WorkflowArtifact getScopedArtifact(Long artifactId) {
        if (artifactId == null) {
            throw new BusinessException(ResponseEnum.PARAM_ERROR);
        }
        LambdaQueryWrapper<WorkflowArtifact> wrapper = Wrappers.lambdaQuery(WorkflowArtifact.class)
                .eq(WorkflowArtifact::getId, artifactId)
                .eq(WorkflowArtifact::getDeleted, Boolean.FALSE);
        applyCurrentArtifactScope(wrapper);
        WorkflowArtifact artifact = getOne(wrapper, false);
        if (artifact == null) {
            throw new BusinessException(ResponseEnum.DATA_NOT_EXIST);
        }
        return artifact;
    }

    private LambdaQueryWrapper<WorkflowArtifact> scopeQuery(Long workflowId) {
        LambdaQueryWrapper<WorkflowArtifact> wrapper = Wrappers.lambdaQuery(WorkflowArtifact.class)
                .eq(WorkflowArtifact::getWorkflowId, workflowId)
                .eq(WorkflowArtifact::getDeleted, Boolean.FALSE);
        applyCurrentArtifactScope(wrapper);
        return wrapper;

View on GitHub (pinned to 5e758547a8)