{"record":{"id":"bfddf8156375a222","repo":"instructure/canvas-lms","slug":"invalid-mode-mode-value","errorCode":null,"errorMessage":"Invalid mode: #{mode_value}","messagePattern":"Invalid mode: #(.+?)","errorType":"validation","errorClass":"CanvasOperations::Errors::InvalidPropertyValue","httpStatus":null,"severity":"error","filePath":"lib/canvas_operations/data_fixup.rb","lineNumber":70,"sourceCode":"    setting :processing_sleep_time, default: 0.1, type_cast: :to_f\n\n    before_run :ensure_validate_environment\n    before_run :ensure_valid_shard\n\n    class << self\n      # Get the current mode for this datafixup operation.\n      #\n      # @return [Symbol, nil] the current mode (:batch or :individual_record), or nil if not set\n      attr_reader :mode\n\n      # Set the mode in which the datafixup should operate.\n      #\n      # Must be one of the values defined in VALID_MODES.\n      # Use `self.mode = :batch` or `self.mode = :individual_record` at the class level.\n      #\n      # @param mode_value [Symbol] the mode to set (:batch or :individual_record)\n      def mode=(mode_value)\n        raise CanvasOperations::Errors::InvalidPropertyValue, \"Invalid mode: #{mode_value}\" unless VALID_MODES.include?(mode_value)\n\n        @mode = mode_value\n      end\n\n      # The ActiveRecord scope the datafixup should iterate over.\n      #\n      # Use `scope { Model.where(...) }` at the class level, or override this method\n      # for more complex logic that requires instance variables or methods.\n      def scope(&block)\n        if block_given?\n          @scope_block = block\n        else\n          @scope_block\n        end\n      end\n\n      # Get the current batch strategy for this datafixup operation.\n      #","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/canvas_operations/data_fixup.rb#L52-L88","documentation":"CanvasOperations::Errors::InvalidPropertyValue raised by DataFixup.mode= when the assigned value is not one of VALID_MODES (:batch or :individual_record). The mode selects how the fixup iterates rows, so an unknown mode cannot be dispatched.","triggerScenarios":"Writing self.mode = :per_record or self.mode = 'batch' (String instead of Symbol) at the class level of a DataFixup subclass.","commonSituations":"Inventing a mode name not in VALID_MODES; passing the mode from config as a string; typos such as :individiual_record.","solutions":["Use exactly :batch or :individual_record (Symbol)","Convert config strings to symbols: ENV['MODE'].to_sym (after verifying it's valid)","Check VALID_MODES on the class to see the allowed values"],"exampleFix":"// before\nself.mode = 'batch'\n// after\nself.mode = :batch","handlingStrategy":"validation","validationCode":"raise 'bad mode' unless [:batch, :individual_record].include?(mode)","typeGuard":null,"tryCatchPattern":"rescue CanvasOperations::Errors::InvalidPropertyValue\n  self.mode = :individual_record\nend","preventionTips":["Only use modes listed in VALID_MODES","Coerce config strings with .to_sym and verify membership","Keep a subclass template with the correct mode set"],"tags":["ruby","enum","configuration","canvas-operations"],"backgroundTag":"invalid-enum-value","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"}