flipped-aurora/gin-vue-admin · error
function client.ListObjectsV2() failed, err:
Error message
function client.ListObjectsV2() failed, err:
What it means
ListFiles in the AWS S3 upload adapter wraps any error returned by the AWS SDK's ListObjectsV2 API call into this generic message. It means the S3 ListObjectsV2 request itself failed — the SDK got a transport, auth, permission, or service-side rejection before any listing results could be processed. The original AWS error text is appended verbatim after 'err:'.
Source
Thrown at server/utils/upload/aws_s3.go:188
}
bucket := global.GVA_CONFIG.AwsS3.Bucket
if limit <= 0 {
limit = 100
}
input := &s3.ListObjectsV2Input{
Bucket: aws.String(bucket),
Prefix: aws.String(prefix),
MaxKeys: aws.Int32(int32(limit)),
}
if cursor != "" {
input.ContinuationToken = aws.String(cursor)
}
out, err := client.ListObjectsV2(ctx, input)
if err != nil {
return nil, "", false, errors.New("function client.ListObjectsV2() failed, err:" + err.Error())
}
for _, obj := range out.Contents {
fi := FileInfo{}
if obj.Key != nil {
fi.Key = *obj.Key
}
if obj.Size != nil {
fi.Size = *obj.Size
}
if obj.LastModified != nil {
fi.LastModified = *obj.LastModified
}
files = append(files, fi)
}
if out.NextContinuationToken != nil {
nextCursor = *out.NextContinuationTokenView on GitHub (pinned to 3136500ef3)
Solutions
- Read the appended err text: if AccessDenied, grant s3:ListBucket on the bucket to the configured AccessKey's IAM identity
- Verify server config: Bucket, Region/Endpoint, AccessKey, SecretKey are correct for the target S3-compatible service
- If triggered by a bad cursor, restart pagination with an empty cursor and return fresh ContinuationToken to clients instead of reusing stale ones
- Check network reachability (DNS, proxy, VPC endpoint) from the server to the S3 endpoint
- Enable AWS SDK debug logging to capture the HTTP status and request ID from the failed call
Example fix
// before
cursor := oldCursorFromClient // possibly stale
files, next, hasMore, err := uploader.ListFiles(ctx, prefix, cursor, 100)
// after
if cursor == "stale-signature" { // detect S3 error text mentioning ContinuationToken
files, next, hasMore, err = uploader.ListFiles(ctx, prefix, "", 100)
} Defensive patterns
Strategy: try-catch
Validate before calling
if uploader == nil || cfg.Bucket == "" || cfg.AccessKey == "" || cfg.SecretKey == "" {
return errors.New("s3 uploader not configured")
} Type guard
func isAWSErr(err error) awserr.Error { var e awserr.Error; return errors.As(err, &e) } Try / catch
files, next, hasMore, err := uploader.ListFiles(ctx, prefix, cursor, 100)
if err != nil {
logger.Error("ListFiles failed", zap.Error(err))
if strings.Contains(err.Error(), "ContinuationToken") {
files, next, hasMore, err = uploader.ListFiles(ctx, prefix, "", 100)
}
if err != nil { return err }
} Prevention
- Grant s3:ListBucket to the service account and verify with aws CLI before deploying
- Validate bucket/region/endpoint config at startup with a smoke ListObjectsV2 call
- Never expose or persist pagination cursors beyond their validity; restart on stale-cursor errors
- Monitor the appended err text per error code and alert on AccessDenied
When it happens
Trigger: Calling ListFiles(ctx, prefix, cursor, limit) on the aws_s3 uploader when: credentials are invalid/expired, the IAM identity lacks s3:ListBucket on the bucket, the bucket name/region are wrong, a custom endpoint is unreachable, or the network to S3 is down. The caller-supplied cursor is passed as ContinuationToken, and an invalid/expired cursor also makes the call fail.
Common situations: Wrong AWS_REGION for the bucket (SignatureDoesNotMatch/IllegalLocationConstraint), IAM policy missing s3:ListBucket (AccessDenied), non-existent bucket name, stale pagination cursor passed after bucket contents changed, misconfigured custom endpoint for MinIO/on-prem S3, VPC without internet/endpoint access.
Related errors
- function bucket.IsObjectExist() failed, err:
- function config.LoadDefaultConfig() failed, err:
- function client.DeleteObject() failed, err:
- function client.DeleteObjects() failed, err:
- function client.ListObjectsV2() failed, err:
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/179e5dca73bc0777.
Report an issue: GitHub.