{"record":{"id":"3bbb02f13c38344e","repo":"HangfireIO/Hangfire","slug":"current-storage-doesn-t-support-specifying-queues-3bbb02","errorCode":null,"errorMessage":"Current storage doesn't support specifying queues directly for a specific job. Please use the QueueAttribute instead.","messagePattern":"Current storage doesn't support specifying queues directly for a specific job\\. Please use the QueueAttribute instead\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/States/ScheduledState.cs","lineNumber":203,"sourceCode":"            public void Unapply(ApplyStateContext context, IWriteOnlyTransaction transaction)\n            {\n                CheckJobQueueFeatureIsSupported(context);\n\n                transaction.RemoveFromSet(\n                    \"schedule\",\n                    context.BackgroundJob.Job?.Queue == null\n                        ? context.BackgroundJob.Id\n                        : context.BackgroundJob.Job.Queue + ':' + context.BackgroundJob.Id);\n            }\n\n            // ReSharper disable once MemberHidesStaticFromOuterClass\n            public string StateName => ScheduledState.StateName;\n\n            private static void CheckJobQueueFeatureIsSupported(ApplyStateContext context)\n            {\n                if (context.BackgroundJob.Job?.Queue != null && !context.Storage.HasFeature(JobStorageFeatures.JobQueueProperty))\n                {\n                    throw new NotSupportedException(\"Current storage doesn't support specifying queues directly for a specific job. Please use the QueueAttribute instead.\");\n                }\n            }\n        }\n    }\n}\n","sourceCodeStart":185,"sourceCodeEnd":209,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/States/ScheduledState.cs#L185-L209","documentation":"Thrown by ScheduledState.Handler's CheckJobQueueFeatureIsSupported, identical in spirit to error 201 but for the Scheduled state path. It fires when a scheduled job method has a Queue value (e.g. [Queue]) yet the active JobStorage does not declare JobStorageFeatures.JobQueueProperty. Per-job queue selection is only honored by storages that opt in.","triggerScenarios":"Scheduling a job (BackgroundJob.Schedule) whose method carries [Queue(\"...\")] or a manually-set Job.Queue, while using a storage without the JobQueueProperty feature.","commonSituations":"Adding [Queue] to a method assuming all storages honor it; testing against a lightweight/custom storage that omits the feature flag; mixing storages across environments.","solutions":["Remove the [Queue] attribute and have the worker server subscribe to the queue via BackgroundJobServerOptions.Queues.","Use a storage that enables JobStorageFeatures.JobQueueProperty, or extend your custom storage to advertise it.","At startup, detect [Queue] usage against storage.Features and fail or warn early."],"exampleFix":"// before\n[Queue(\"bulk\")]\npublic void RunReport() { ... }\nBackgroundJob.Schedule(() => RunReport(), TimeSpan.FromHours(1));\n\n// after\npublic void RunReport() { ... }\nBackgroundJob.Schedule(() => RunReport(), TimeSpan.FromHours(1));\n// worker: Queues = new[] { \"bulk\", \"default\" }","handlingStrategy":"validation","validationCode":"if (JobStorage.Current != null && !JobStorage.Current.HasFeature(JobStorageFeatures.JobQueueProperty))\n    throw new InvalidOperationException(\n        \"Current storage cannot honor [Queue]; remove the attribute or change storage.\");","typeGuard":null,"tryCatchPattern":"try { BackgroundJob.Schedule(() => Work(), delay); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"QueueAttribute\"))\n{\n    // remove per-job queue and rely on server queues\n}","preventionTips":["Keep [Queue] usage gated on a storage-capability check at startup.","Prefer server-side Queues configuration over per-method [Queue] when storage support is uncertain.","Add an integration test that schedules with [Queue] and asserts no NotSupportedException."],"tags":["storage-feature","queue","scheduled","not-supported"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}