{"record":{"id":"9f77cc00b2cd25df","repo":"instructure/canvas-lms","slug":"missing-required-attributes-missing-to-a","errorCode":null,"errorMessage":"missing required attributes: #{missing.to_a}","messagePattern":"missing required attributes: #(.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"gems/event_stream/lib/event_stream/attr_config.rb","lineNumber":92,"sourceCode":"          value = typecast.call(name, value)\n        end\n        attr_config_values[name] = value\n      end\n    end\n  end\n\n  def attr_config_values\n    @attr_config_values ||= {}\n  end\n\n  def attr_config_validate\n    self.class.attr_config_defaults.each do |key, value|\n      unless attr_config_values.key?(key)\n        attr_config_values[key] = value\n      end\n    end\n    missing = self.class.attr_config_known - attr_config_values.keys\n    raise ArgumentError, \"missing required attributes: #{missing.to_a}\" unless missing.empty?\n  end\n\n  def self.included(base)\n    base.extend(ClassMethods)\n  end\nend\n","sourceCodeStart":74,"sourceCodeEnd":99,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/gems/event_stream/lib/event_stream/attr_config.rb#L74-L99","documentation":"attr_config_validate runs after defaults are applied and asserts that every attribute declared known in the attr_config was supplied (or defaulted). If any known attribute has neither a value nor a default, ArgumentError lists the missing keys. It enforces that stream/index definitions are complete before use.","triggerScenarios":"Instantiating an EventStream::Stream or Index whose class defines an attr_config attribute but neither passes a value for it at construction nor provides a default; calling attr_config_validate manually with a partially populated config.","commonSituations":"Forgetting a required field in a custom event stream definition; renaming an attribute in one place but not at all construction sites; a nil-vs-absent confusion where the key was never set at all.","solutions":["Supply values for every attribute named in `missing required attributes:`","Add defaults via attr_config declarations so validation passes","Remove attributes from the attr_config declaration if they are no longer needed","Check recent changes to the stream/index class for newly required attributes"],"exampleFix":"// before\nEventStream::Stream.new(aggregate: ...)\n// after\nEventStream::Stream.new(aggregate: ..., record: ..., attribute_data: ...)","handlingStrategy":"validation","validationCode":"missing = klass.attr_config_known - (given.keys | klass.attr_config_defaults.keys)\nraise \"missing: #{missing}\" unless missing.empty?","typeGuard":null,"tryCatchPattern":"begin\n  stream = EventStream::Stream.new(**attrs)\nrescue ArgumentError => e\n  raise unless e.message.start_with?('missing required attributes')\n  Rails.logger.error(\"Incomplete stream config: #{e.message}\")\nend","preventionTips":["Declare defaults for every attr_config attribute","Centralize stream instantiation in one factory","Add specs that instantiate every stream class with defaults"],"tags":["ruby","event-stream","validation","missing-attribute"],"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"}