{"record":{"id":"00e5fef379cfafac","repo":"dotnet/orleans","slug":"not-all-required-queries-found-missing-are-stri","errorCode":null,"errorMessage":"Not all required queries found. Missing are: {string.Join(\",\", missingQueryKeys)}","messagePattern":"Not all required queries found\\. Missing are: (.+?)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/AdoNet/Shared/Storage/DbStoredQueries.cs","lineNumber":43,"sourceCode":"// No default namespace intentionally to cause compile errors if something is not defined\n#endif\n{\n    /// <summary>\n    /// This class implements the expected contract between Orleans and the underlying relational storage.\n    /// It makes sure all the stored queries are present and \n    /// </summary>\n    internal class DbStoredQueries\n    {\n        private readonly Dictionary<string, string> queries;\n\n        internal DbStoredQueries(Dictionary<string, string> queries)\n        {\n            var fields = typeof(DbStoredQueries).GetProperties(BindingFlags.Instance | BindingFlags.NonPublic)\n                .Select(p => p.Name);\n            var missingQueryKeys = fields.Except(queries.Keys).ToArray();\n            if (missingQueryKeys.Length > 0)\n            {\n                throw new ArgumentException(\n                    $\"Not all required queries found. Missing are: {string.Join(\",\", missingQueryKeys)}\");\n            }\n            this.queries = queries;\n        }\n\n        /// <summary>\n        /// The query that's used to get all the stored queries.\n        /// this will probably be the same for all relational dbs.\n        /// </summary>\n        internal const string GetQueriesKey = \"SELECT QueryKey, QueryText FROM OrleansQuery\";\n\n#if CLUSTERING_ADONET || TESTER_SQLUTILS\n\n        /// <summary>\n        /// A query template to retrieve gateway URIs.\n        /// </summary>        \n        internal string GatewaysQueryKey => queries[nameof(GatewaysQueryKey)];\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/AdoNet/Shared/Storage/DbStoredQueries.cs#L25-L61","documentation":"Thrown by the DbStoredQueries constructor when the supplied queries dictionary is missing one or more keys that correspond to the instance properties compiled in for the current feature (clustering, reminders, persistence, streaming, or grain directory). The message lists exactly which QueryKeys are absent, so the OrleansQuery table or the in-memory dictionary is incomplete.","triggerScenarios":"Constructing DbStoredQueries with a Dictionary<string,string> whose keys do not cover every property name defined under the active #if directive (e.g. STREAMING_ADONET expects QueueStreamMessageKey, GetStreamMessagesKey, ConfirmStreamMessagesKey, FailStreamMessageKey, EvictStreamMessagesKey, EvictStreamDeadLettersKey). The missing keys are reported in the exception message.","commonSituations":"The OrleansQuery table was seeded with scripts for a different feature set (e.g. clustering scripts applied but streaming used); a partial/older setup script was run; a custom query loader dropped entries; version mismatch where newer Orleans expects additional QueryKeys.","solutions":["Run the full Orleans setup script for your database vendor and Orleans version so all OrleansQuery rows exist for every feature you use.","Inspect the exception's missing-keys list and insert those specific QueryKey/QueryText rows into the OrleansQuery table.","Confirm you applied the streaming (or clustering/reminders/persistence/grain-directory) script, not just one of them."],"exampleFix":"-- before: OrleansQuery missing streaming keys\nINSERT INTO OrleansQuery (QueryKey, QueryText) VALUES ('GetStreamMessagesKey', 'SELECT ...');\n-- add every key listed in the exception message, e.g. QueueStreamMessageKey, ConfirmStreamMessagesKey,\n-- FailStreamMessageKey, EvictStreamMessagesKey, EvictStreamDeadLettersKey","handlingStrategy":"validation","validationCode":"// After loading queries from OrleansQuery, verify coverage before constructing DbStoredQueries.\nvar required = typeof(DbStoredQueries).GetProperties(BindingFlags.Instance | BindingFlags.NonPublic).Select(p => p.Name);\nvar missing = required.Except(loadedQueries.Keys).ToArray();\nif (missing.Length > 0)\n    throw new InvalidOperationException($\"Run the Orleans setup script; missing query keys: {string.Join(\",\", missing)}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the full Orleans setup script for every feature (clustering, reminders, persistence, streaming, grain directory) you use.","After upgrades, re-run migration scripts since new QueryKeys may have been added.","Add a deployment-time check that queries the OrleansQuery table for all expected keys."],"tags":["adonet","schema","stored-queries","configuration","database","orleans"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}