instructure/canvas-lms · error · ArgumentError

config name required

Error message

config name required

What it means

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.

Solutions

  1. Pass the correct category symbol/string, e.g. DatabaseBuilder.configured?(:live_events).
  2. Check where the category variable comes from and fix the missing setting (ENV var, dynamic_settings key).
  3. Guard the call site: only query configured? when the category name is present.

Example fix

// before
DatabaseBuilder.configured?(Config::DYNAMO_CATEGORY) # nil -> ArgumentError
// after
category = Config::DYNAMO_CATEGORY || :live_events
DatabaseBuilder.configured?(category)
Defensive patterns

Strategy: validation

Validate before calling

# ruby
category.present? or raise "dynamo category not configured"
DatabaseBuilder.configured?(category)

Try / catch

begin
  DatabaseBuilder.configured?(category)
rescue ArgumentError => e
  raise "category missing from settings" if e.message == "config name required"
end

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/62852748e52ebccf. Report an issue: GitHub.

Appendix: source

Thrown at lib/canvas/dynamo_db/database_builder.rb:30

# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

module Canvas
  module DynamoDB
    module DatabaseBuilder
      class InvalidConfig < StandardError; end

      def self.reset
        @clients = {}
      end

      def self.configured?(category, environment = default_environment)
        raise ArgumentError, "config name required" if category.blank?

        config = configs(environment)[category]
        !!(config && config[:table_prefix] && config[:region])
      end

      def self.from_config(category, environment = default_environment, credentials: nil)
        key = [category, environment]
        @clients ||= {}
        @clients.fetch(key) do
          config = configs(environment)[category]
          unless config
            @clients[key] = nil
            return nil
          end
          validate_config(config)
          opts = {
            credentials: credentials || Canvas::AwsCredentialProvider.new("auditors_creds", config["vault_credential_path"]),
            region: config[:region],

View on GitHub (pinned to 1c9f0bb801)