{"record":{"id":"62852748e52ebccf","repo":"instructure/canvas-lms","slug":"config-name-required","errorCode":null,"errorMessage":"config name required","messagePattern":"config name required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/canvas/dynamo_db/database_builder.rb","lineNumber":30,"sourceCode":"# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\n# details.\n#\n# You should have received a copy of the GNU Affero General Public License along\n# with this program. If not, see <http://www.gnu.org/licenses/>.\n\nmodule Canvas\n  module DynamoDB\n    module DatabaseBuilder\n      class InvalidConfig < StandardError; end\n\n      def self.reset\n        @clients = {}\n      end\n\n      def self.configured?(category, environment = default_environment)\n        raise ArgumentError, \"config name required\" if category.blank?\n\n        config = configs(environment)[category]\n        !!(config && config[:table_prefix] && config[:region])\n      end\n\n      def self.from_config(category, environment = default_environment, credentials: nil)\n        key = [category, environment]\n        @clients ||= {}\n        @clients.fetch(key) do\n          config = configs(environment)[category]\n          unless config\n            @clients[key] = nil\n            return nil\n          end\n          validate_config(config)\n          opts = {\n            credentials: credentials || Canvas::AwsCredentialProvider.new(\"auditors_creds\", config[\"vault_credential_path\"]),\n            region: config[:region],","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/canvas/dynamo_db/database_builder.rb#L12-L48","documentation":"Canvas::DynamoDB::DatabaseBuilder.configured? raises ArgumentError 'config name required' when the category argument is blank. The category names the dynamo_db config entry (e.g. :live_events) and is mandatory for looking up its table_prefix and region.","triggerScenarios":"Calling DatabaseBuilder.configured?(nil), configured?(\"\") or configured?(some_variable) where the variable is nil because the config category name was not loaded from settings/environment.","commonSituations":"Reading the category name from ENV or dynamic settings where the key is absent, yielding nil; typos in a yaml key lookup upstream of the call; refactors that drop the literal category argument.","solutions":["Pass the correct category symbol/string, e.g. DatabaseBuilder.configured?(:live_events).","Check where the category variable comes from and fix the missing setting (ENV var, dynamic_settings key).","Guard the call site: only query configured? when the category name is present."],"exampleFix":"// before\nDatabaseBuilder.configured?(Config::DYNAMO_CATEGORY) # nil -> ArgumentError\n// after\ncategory = Config::DYNAMO_CATEGORY || :live_events\nDatabaseBuilder.configured?(category)","handlingStrategy":"validation","validationCode":"# ruby\ncategory.present? or raise \"dynamo category not configured\"\nDatabaseBuilder.configured?(category)","typeGuard":null,"tryCatchPattern":"begin\n  DatabaseBuilder.configured?(category)\nrescue ArgumentError => e\n  raise \"category missing from settings\" if e.message == \"config name required\"\nend","preventionTips":["Use literal symbols for categories (:live_events) instead of derived variables.","Fail fast at boot if the category setting is absent.","Add unit tests covering nil/blank category inputs."],"tags":["dynamodb","argument-error","config"],"backgroundTag":"missing-required-argument","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}