iflytek/astron-agent · error · BusinessException
50006
50006
Error message
system.s3.presign.error
What it means
generatePresignedGetUrl throws the same BusinessException built from ResponseEnum.S3_PRESIGN_ERROR (code 50006, message 'system.s3.presign.error') when the objectKey is null or blank. It is argument validation before any SDK interaction; the numeric code 50006 is what callers see in the error response body.
Solutions
- Validate the object key in the caller/endpoint layer and return a 400-style error instead of hitting presign
- Repair the data: backfill the missing object key on the stored record
- Fix key derivation so it cannot produce an empty value
Example fix
// before
String url = s3ClientUtil.generatePresignedGetUrl(bucket, record.getObjectKey(), 3600);
// after
String key = record.getObjectKey();
if (key == null || key.trim().isEmpty()) {
throw new IllegalArgumentException("Record has no object key: " + record.getId());
}
String url = s3ClientUtil.generatePresignedGetUrl(bucket, key, 3600); Defensive patterns
Strategy: validation
Validate before calling
if (objectKey == null || objectKey.trim().isEmpty()) {
throw new IllegalArgumentException("objectKey required for presigned GET");
} Type guard
static boolean hasText(String s) { return s != null && !s.trim().isEmpty(); } Try / catch
try {
return s3ClientUtil.generatePresignedGetUrl(bucket, key, expiry);
} catch (BusinessException e) {
if ("50006".equals(String.valueOf(e.getCode()))) {
log.error("presign GET rejected for key '{}'", key, e);
}
throw e;
} Prevention
- Treat object key as a required column; enforce NOT NULL in the schema
- Validate the key parameter in download endpoints before presigning
- Backfill or quarantine records with missing object keys
When it happens
Trigger: Calling generatePresignedGetUrl(bucket, null, expiry) or with an empty/whitespace object key — e.g. a stored file record with a missing object key field.
Common situations: Database record has NULL object_key, a download endpoint received a missing/blank key parameter, or key derivation from an id produced an empty string.
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
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/56fa918e2d613f0e.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/S3ClientUtil.java:979
}
/**
* Generate a presigned GET URL for reading/downloading an object.
*
* @param bucketName target bucket
* @param objectKey object key
* @param expirySeconds expiry in seconds (MinIO requires 1..604800)
* @return URL usable for HTTP GET
*/
public String generatePresignedGetUrl(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.GET)
.bucket(bucketName)
.object(objectKey)
.expiry(expirySeconds)
.build());
} catch (ErrorResponseException | InsufficientDataException | InternalException | InvalidKeyException
| InvalidResponseException | IOException | NoSuchAlgorithmException | XmlParserException
| ServerException e) {
log.error(View on GitHub (pinned to 5e758547a8)