{"record":{"id":"76a5147b253b0fdc","repo":"iflytek/astron-agent","slug":"s3-presign-error-76a514","errorCode":"S3_PRESIGN_ERROR","errorMessage":"S3_PRESIGN_ERROR","messagePattern":"S3_PRESIGN_ERROR","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/util/S3Util.java","lineNumber":374,"sourceCode":"            int exp = (expirySeconds != null && expirySeconds > 0) ? expirySeconds : presignExpirySeconds;\n            return minioClient.getPresignedObjectUrl(\n                    GetPresignedObjectUrlArgs.builder()\n                            .method(Method.PUT)\n                            .bucket(bucketName)\n                            .object(objectKey)\n                            .expiry(exp)\n                            .build());\n        } catch (ErrorResponseException\n                | InsufficientDataException\n                | InternalException\n                | InvalidKeyException\n                | InvalidResponseException\n                | IOException\n                | NoSuchAlgorithmException\n                | XmlParserException\n                | ServerException e) {\n            log.debug(\"S3 presign error:\", e);\n            throw new BusinessException(ResponseEnum.S3_PRESIGN_ERROR);\n        }\n    }\n}\n","sourceCodeStart":356,"sourceCodeEnd":378,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/util/S3Util.java#L356-L378","documentation":"S3_PRESIGN_ERROR is thrown by S3Util.generatePresignedPutUrl(objectKey, expirySeconds) when MinIO's getPresignedObjectUrl fails. Presigning requires a correctly signed request against the configured credentials and endpoint; any signing, crypto, IO, or server error is converted into this BusinessException. Note: this method is deprecated in favor of S3ClientUtil.generatePresignedPutUrl().","triggerScenarios":"minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs PUT with bucket, objectKey, expiry) throws one of the caught exceptions: ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException, ServerException.","commonSituations":"Missing or invalid s3.accessKey/s3.secretKey (InvalidKeyException from HMAC signing); unreachable s3.endpoint; expiry value out of the S3-allowed range (1s-604800s); empty s3.bucket so the presign targets a non-existent bucket; clock skew invalidating signatures.","solutions":["Enable/inspect the 'S3 presign error' debug log for the underlying exception","Verify s3.accessKey and s3.secretKey are set and valid (InvalidKeyException usually means bad/empty credentials)","Ensure s3.bucket is configured and the bucket exists","Pass an expirySeconds within 1-604800, or rely on the s3.presignExpirySeconds default","Migrate to the non-deprecated com.iflytek.astron.console.commons.util.S3ClientUtil.generatePresignedPutUrl()","Check network/DNS reachability of s3.endpoint and host clock sync"],"exampleFix":"// before\nreturn minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()\n        .method(Method.PUT).bucket(bucketName).object(objectKey).expiry(exp).build());\n// after\nint safeExp = Math.min(Math.max(exp, 1), 604800);\nreturn minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()\n        .method(Method.PUT).bucket(bucketName).object(objectKey).expiry(safeExp).build());","handlingStrategy":"try-catch","validationCode":"// Pre-check credentials and expiry bounds before presigning\nif (isBlank(accessKey) || isBlank(secretKey)) throw new IllegalStateException(\"s3 accessKey/secretKey not configured\");\nif (isBlank(bucketName)) throw new IllegalStateException(\"s3.bucket not configured\");\nint exp = (expirySeconds != null && expirySeconds > 0) ? expirySeconds : 600;\nif (exp < 1 || exp > 604800) throw new IllegalArgumentException(\"expiry must be 1..604800 seconds\");","typeGuard":null,"tryCatchPattern":"try {\n    String url = s3Util.generatePresignedPutUrl(objectKey, expirySeconds);\n} catch (BusinessException e) {\n    log.error(\"presign failed; check 'S3 presign error' debug log and credentials\", e);\n    throw e; // or fall back to a server-mediated upload endpoint\n}","preventionTips":["Ensure s3.accessKey/s3.secretKey are present and valid before presigning","Keep expiry within the S3 limit of 1 to 604800 seconds","Verify s3.endpoint reachability and clock synchronization (signature validity)","Migrate to the supported S3ClientUtil.generatePresignedPutUrl() since this method is deprecated forRemoval"],"tags":["s3","minio","presigned-url","signing"],"backgroundTag":"missing-credentials","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"}