dotnet/orleans · error · AggregateException
Error doing {operation} for SQS queue {QueueName}
Error message
Error doing {operation} for SQS queue {QueueName} What it means
This is the universal error wrapper in SQSStorage.ReportErrorAndRethrow. Every SQS operation (Init, Add, Get, Delete, DeleteQueue) funnels failures here: it logs via LogErrorSQSOperation and rethrows the original exception wrapped in an AggregateException whose message names the operation and queue. The message text is a format string interpolating {operation} (the method name) and {QueueName}.
Source
Thrown at src/AWS/Orleans.Streaming.SQS/Storage/SQSStorage.cs:236
if (string.IsNullOrWhiteSpace(message.ReceiptHandle))
throw new ArgumentNullException(nameof(message.ReceiptHandle));
if (string.IsNullOrWhiteSpace(queueUrl))
throw new InvalidOperationException("Queue not initialized");
await sqsClient.DeleteMessageAsync(
new DeleteMessageRequest { QueueUrl = queueUrl, ReceiptHandle = message.ReceiptHandle });
}
catch (Exception exc)
{
ReportErrorAndRethrow(exc, "DeleteMessage");
}
}
private void ReportErrorAndRethrow(Exception exc, string operation)
{
LogErrorSQSOperation(exc, operation, QueueName);
throw new AggregateException($"Error doing {operation} for SQS queue {QueueName}", exc);
}
[LoggerMessage(
EventId = (int)ErrorCode.StreamProviderManagerBase,
Level = LogLevel.Error,
Message = "Error doing {Operation} for SQS queue {QueueName}"
)]
private partial void LogErrorSQSOperation(Exception exception, string operation, string queueName);
}
}
View on GitHub (pinned to fca799fa70)
Solutions
- Inspect AggregateException.InnerExceptions[0] (or .InnerException) for the real AWS error and address that.
- Verify the connection string: AccessKey, SecretKey, and Service (region) are present and correct.
- For throttling, reduce batch size / concurrency or request an SQS quota increase.
- Confirm the IAM principal has sqs:* permissions on the queue ARN.
- Reproduce locally with localstack to isolate credentials from network.
Example fix
// before
catch (AggregateException ex)
{
logger.LogError(ex, "failed"); // real cause buried
}
// after
catch (AggregateException ex)
{
var root = ex.InnerExceptions.Count > 0 ? ex.InnerExceptions[0] : ex.InnerException;
logger.LogError(root, "SQS {Op} failed for {Queue}", op, queue);
} Defensive patterns
Strategy: try-catch
Try / catch
try { await storage.GetMessages(count); }
catch (AggregateException ex)
{
var root = ex.InnerExceptions.Count > 0 ? ex.InnerExceptions[0] : ex.InnerException;
// handle AmazonSQSException, AuthorizationException, timeout, etc.
logger.LogError(root, "SQS operation failed for queue {Queue}", storage.QueueName);
throw;
} Prevention
- Always unwrap AggregateException.InnerExceptions to find the AWS root cause.
- Verify credentials, region, and IAM sqs permissions.
- Implement retry with backoff for transient AWS errors, not for auth failures.
When it happens
Trigger: Any exception during an SQS call: AWS auth/credential failure, wrong region, throttling, network timeout, queue-not-found, malformed request, or an inner InvalidOperationException such as 'Queue not initialized'. All surface as this AggregateException.
Common situations: Bad/missing AWS credentials; wrong region in the connection string 'Service=' value; SQS throttling under load; localstack misconfiguration; the queueUrl-not-initialized errors (60/65) rethrown through this wrapper.
Related errors
- count
- message
- ReceiptHandle
- dataConnectionString
- SQSStream stream provider currently does not support non-nul
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/44d71adbdba342a4.
Report an issue: GitHub.