{"record":{"id":"3f995d7793bee7d4","repo":"dotnet/orleans","slug":"sqsstream-stream-provider-currently-does-not-suppo","errorCode":null,"errorMessage":"SQSStream stream provider currently does not support non-null StreamSequenceToken.","messagePattern":"SQSStream stream provider currently does not support non-null StreamSequenceToken\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/AWS/Orleans.Streaming.SQS/Streams/SQSAdapter.cs","lineNumber":47,"sourceCode":"            if (string.IsNullOrEmpty(serviceId)) throw new ArgumentNullException(nameof(serviceId));\n            this.loggerFactory = loggerFactory;\n            this.serializer = serializer;\n            DataConnectionString = dataConnectionString;\n            this.ServiceId = serviceId;\n            Name = providerName;\n            this.streamQueueMapper = streamQueueMapper;\n        }\n\n        public IQueueAdapterReceiver CreateReceiver(QueueId queueId)\n        {\n            return SQSAdapterReceiver.Create(this.serializer, this.loggerFactory, queueId, DataConnectionString, this.ServiceId);\n        }\n\n        public async Task QueueMessageBatchAsync<T>(StreamId streamId, IEnumerable<T> events, StreamSequenceToken? token, Dictionary<string, object>? requestContext)\n        {\n            if (token != null)\n            {\n                throw new ArgumentException(\"SQSStream stream provider currently does not support non-null StreamSequenceToken.\", nameof(token));\n            }\n            var queueId = streamQueueMapper.GetQueueForStream(streamId);\n            if (!Queues.TryGetValue(queueId, out var queue))\n            {\n                var tmpQueue = new SQSStorage(this.loggerFactory, queueId.ToString(), DataConnectionString, this.ServiceId);\n                await tmpQueue.InitQueueAsync();\n                queue = Queues.GetOrAdd(queueId, tmpQueue);\n            }\n            var msg = SQSBatchContainer.ToSQSMessage(this.serializer, streamId, events, requestContext);\n            await queue.AddMessage(msg);\n        }\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":61,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/AWS/Orleans.Streaming.SQS/Streams/SQSAdapter.cs#L29-L61","documentation":"Thrown by SQSAdapter.QueueMessageBatchAsync when a non-null StreamSequenceToken is supplied. The SQS stream provider is non-rewindable (IsRewindable == false) and does not encode sequence tokens into SQS messages, so passing a token is rejected to prevent silent data-sequencing bugs.","triggerScenarios":"Calling QueueMessageBatchAsync with a token argument, or wiring the SQS provider into a pipeline that forwards tokens (e.g., a rewindable upstream or a custom observer that attaches StreamSequenceTokenV2).","commonSituations":"Mixing the SQS provider with rewindable semantics; porting code from EventHub/Azure Stream providers that do accept tokens; custom stream intermediaries that always forward a token.","solutions":["Pass null for the token when producing to an SQS stream.","If you need rewind/token semantics, use a provider that supports it (e.g., EventHub) instead of SQS.","Audit custom observers/interceptors to ensure they do not attach tokens before the SQS adapter.","Document at the call site that SQS streams are fire-and-forget / non-rewindable."],"exampleFix":"// before\nawait adapter.QueueMessageBatchAsync(streamId, events, token, ctx); // token != null -> throws\n\n// after\nawait adapter.QueueMessageBatchAsync(streamId, events, null, ctx);","handlingStrategy":"validation","validationCode":"// Never pass a token to an SQS stream.\nStreamSequenceToken? token = null;\nawait adapter.QueueMessageBatchAsync(streamId, events, token, ctx);","typeGuard":null,"tryCatchPattern":"try { await adapter.QueueMessageBatchAsync(streamId, events, token, ctx); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"StreamSequenceToken\"))\n{\n    logger.LogWarning(\"SQS streams ignore StreamSequenceToken; retrying with null token.\");\n    await adapter.QueueMessageBatchAsync(streamId, events, null, ctx);\n}","preventionTips":["Pass null for the token when producing to SQS streams.","Use a rewindable provider if you need token semantics.","Document non-rewindable behavior at producer call sites."],"tags":["aws","sqs","streaming","orleans","api-contract"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}