instructure/canvas-lms · error · InvalidConfig

No table prefix specified for: #

Error message

No table prefix specified for: #{category.inspect}

What it means

Canvas::DynamoDB::DatabaseBuilder.validate_config raises InvalidConfig 'No table prefix specified for: <category>' when the loaded config hash lacks a :table_prefix key (or it is blank). Table prefix is required to namespace the DynamoDB tables for that category. Note: the message interpolates `category`, which is not a parameter of validate_config — a latent NameError/bug alongside the intended message.

Solutions

  1. Add table_prefix to the category's config in the dynamo_db yaml for the environment.
  2. Validate the config file shape after editing (all categories have table_prefix and region).
  3. If the prefix genuinely shouldn't be needed, use a different storage backend; DynamoDB builder requires it.
  4. Fix validate_config to interpolate the category argument (pass category in) so the error names the offending entry.

Example fix

// before
dynamo_db:
  live_events:
    region: us-east-1
// after
dynamo_db:
  live_events:
    region: us-east-1
    table_prefix: live_events
Defensive patterns

Strategy: validation

Validate before calling

# ruby
cfg = configs(environment)[category]
cfg[:table_prefix].present? && cfg[:region].present? or raise "invalid dynamo config for #{category}"

Try / catch

begin
  DatabaseBuilder.from_config(category)
rescue Canvas::DynamoDB::DatabaseBuilder::InvalidConfig => e
  abort(e.message)
end

Prevention

When it happens

Trigger: Calling from_config for a category whose yaml config (config/<env>.yml or dynamo_db config) exists but omits table_prefix, then validate_config runs while building the client.

Common situations: Hand-rolled dynamo_db config entries missing table_prefix; copy-pasting a config block and deleting the prefix line; environments partially migrated to new config schemas.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

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

          opts[:endpoint] = config[:endpoint] if config[:endpoint]
          fingerprint = "#{category}:#{environment}"
          begin
            @clients[key] = CanvasDynamoDB::Database.new(
              fingerprint,
              prefix: config[:table_prefix],
              client_opts: opts,
              logger: Rails.logger
            )
          rescue => e
            Rails.logger.error "Failed to create DynamoDB client for #{key}: #{e}"
            nil # don't save this nil into @clients[key], so we can retry later
          end
        end
      end

      def self.validate_config(config)
        unless config[:table_prefix].present?
          raise InvalidConfig, "No table prefix specified for: #{category.inspect}"
        end
        unless config[:region].present?
          raise InvalidConfig, "No region specified for: #{category.inspect}"
        end
      end

      def self.default_environment
        Rails.env
      end

      def self.configs(environment = default_environment)
        ConfigFile.load("dynamodb", environment) || {}
      end

      def self.categories
        configs.keys
      end
    end

View on GitHub (pinned to 1c9f0bb801)