iflytek/astron-agent · error · BusinessException
S3_PRESIGN_ERROR
S3_PRESIGN_ERROR
Error message
S3 presign error
What it means
generatePresignedPutUrl validates the bucketName parameter before contacting S3 and throws BusinessException(S3_PRESIGN_ERROR) when it is null or blank. This is a client-side argument validation; no presign request is made.
Solutions
- Pass a non-empty bucket name at the call site
- Check the bucket configuration property is set in application config / environment
- Add startup validation that fails fast when the bucket config is missing
Example fix
// before
String url = s3ClientUtil.generatePresignedPutUrl(config.getBucket(), key, 3600);
// after
String bucket = config.getBucket();
if (bucket == null || bucket.trim().isEmpty()) {
throw new IllegalStateException("S3 bucket name is not configured");
}
String url = s3ClientUtil.generatePresignedPutUrl(bucket, key, 3600); Defensive patterns
Strategy: validation
Validate before calling
if (bucketName == null || bucketName.trim().isEmpty()) {
throw new IllegalStateException("S3 bucket name must be configured");
} Type guard
static boolean hasText(String s) { return s != null && !s.trim().isEmpty(); } Try / catch
try {
return s3ClientUtil.generatePresignedPutUrl(bucket, key, expiry);
} catch (BusinessException e) {
log.error("presign rejected: check bucket configuration", e);
throw e;
} Prevention
- Bind and assert S3 bucket config at application startup
- Use a single config accessor for the bucket so nulls surface in one place
- Add integration tests that fail when bucket config is missing
When it happens
Trigger: Calling generatePresignedPutUrl(null, objectKey, expiry) or with a bucketName that is empty or whitespace-only, usually from an unset configuration property.
Common situations: S3 bucket name missing from application.yml/env, a null value propagated from tenant/space config, or typo'd configuration key so the field defaults to null.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- 50006
- S3_UPLOAD_ERROR
- CODE_EXEC_TIMEOUT_SEC must be between
- CODE_EXEC_MEMORY_LIMIT_MB must be between
- URL is required for ifly or ifly-v2
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/8a75095323b5ea0d.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/S3ClientUtil.java:923
targetObjectKey,
exceptionType(exception));
return false;
}
}
/**
* Generate a presigned PUT URL for browser direct upload.
*
* @param bucketName target bucket
* @param objectKey object key
* @param expirySeconds expiry in seconds (MinIO requires 1..604800)
* @return URL usable for HTTP PUT
*/
public String generatePresignedPutUrl(String bucketName, String objectKey, int expirySeconds) {
// Validate parameters
if (bucketName == null || bucketName.trim().isEmpty()) {
log.error("Bucket name cannot be null or empty");
throw new BusinessException(ResponseEnum.S3_PRESIGN_ERROR);
}
if (objectKey == null || objectKey.trim().isEmpty()) {
log.error("Object key cannot be null or empty");
throw new BusinessException(ResponseEnum.S3_PRESIGN_ERROR);
}
if (expirySeconds < 1 || expirySeconds > 604800) {
log.error("Expiry seconds must be between 1 and 604800, got: {}", expirySeconds);
throw new BusinessException(ResponseEnum.S3_PRESIGN_ERROR);
}
try {
return presignClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
.method(Method.PUT)
.bucket(bucketName)
.object(objectKey)
.expiry(expirySeconds)
.build());
} catch (ErrorResponseException | InsufficientDataException | InternalException | InvalidKeyExceptionView on GitHub (pinned to 5e758547a8)