{"record":{"id":"95958873e53bada0","repo":"dotnet/orleans","slug":"queueid","errorCode":null,"errorMessage":"queueId","messagePattern":"queueId","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/AWS/Orleans.Streaming.SQS/Streams/SQSAdapterReceiver.cs","lineNumber":30,"sourceCode":"namespace OrleansAWSUtils.Streams\n{\n    /// <summary>\n    /// Receives batches of messages from a single partition of a message queue.\n    /// </summary>\n    internal partial class SQSAdapterReceiver : IQueueAdapterReceiver\n    {\n        private SQSStorage? queue;\n        private long lastReadMessage;\n        private Task? outstandingTask;\n        private readonly ILogger logger;\n        private readonly Serializer<SQSBatchContainer> serializer;\n\n\n        public QueueId Id { get; private set; }\n\n        public static IQueueAdapterReceiver Create(Serializer<SQSBatchContainer> serializer, ILoggerFactory loggerFactory, QueueId queueId, string dataConnectionString, string serviceId)\n        {\n            if (queueId.IsDefault) throw new ArgumentNullException(nameof(queueId));\n            if (string.IsNullOrEmpty(dataConnectionString)) throw new ArgumentNullException(nameof(dataConnectionString));\n            if (string.IsNullOrEmpty(serviceId)) throw new ArgumentNullException(nameof(serviceId));\n\n            var queue = new SQSStorage(loggerFactory, queueId.ToString(), dataConnectionString, serviceId);\n            return new SQSAdapterReceiver(serializer, loggerFactory, queueId, queue);\n        }\n\n        private SQSAdapterReceiver(Serializer<SQSBatchContainer> serializer, ILoggerFactory loggerFactory, QueueId queueId, SQSStorage queue)\n        {\n            if (queueId.IsDefault) throw new ArgumentNullException(nameof(queueId));\n            if (queue == null) throw new ArgumentNullException(nameof(queue));\n\n            Id = queueId;\n            this.queue = queue;\n            logger = loggerFactory.CreateLogger<SQSAdapterReceiver>();\n            this.serializer = serializer;\n        }\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/AWS/Orleans.Streaming.SQS/Streams/SQSAdapterReceiver.cs#L12-L48","documentation":"Thrown by SQSAdapterReceiver.Create when the supplied QueueId.IsDefault is true. A default QueueId has no meaningful partition/queue identity, so the receiver cannot bind to a backing SQS queue; the factory rejects it immediately rather than constructing a receiver over an unnamed queue.","triggerScenarios":"Passing default(QueueId) or an uninitialized QueueId to Create, typically because a mapper returned a default or a field was never assigned before the receiver was created.","commonSituations":"Custom IConsistentRingStreamQueueMapper implementations that fall back to default(QueueId); serialization/deserialization paths that yield default; tests that hand-construct receivers without a real queue id.","solutions":["Ensure the QueueId comes from a valid streamQueueMapper.GetQueueForStream result before calling Create.","Validate !queueId.IsDefault in your mapper/adapter before invoking Create.","Initialize all QueueId fields from configuration at startup.","Add a unit test asserting receivers are only created for non-default queue ids."],"exampleFix":"// before\nvar rcv = SQSAdapterReceiver.Create(serializer, lf, default, conn, svc); // throws\n\n// after\nvar queueId = mapper.GetQueueForStream(streamId);\nvar rcv = SQSAdapterReceiver.Create(serializer, lf, queueId, conn, svc);","handlingStrategy":"validation","validationCode":"if (queueId.IsDefault) throw new ArgumentException(\"QueueId must be non-default.\", nameof(queueId));\nvar rcv = SQSAdapterReceiver.Create(serializer, lf, queueId, conn, svc);","typeGuard":"static bool IsUsableQueueId(QueueId id) => !id.IsDefault;","tryCatchPattern":"try { return SQSAdapterReceiver.Create(serializer, lf, queueId, conn, svc); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"queueId\")\n{\n    logger.LogError(\"Cannot create receiver: QueueId is default.\");\n    throw;\n}","preventionTips":["Obtain QueueId only from the stream queue mapper.","Validate !IsDefault before any receiver construction.","Initialize QueueId fields at startup."],"tags":["aws","sqs","streaming","argument-validation","orleans"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}