instructure/canvas-lms · error · CanvasOperations::Errors::InvalidPropertyValue
Invalid mode: #
Error message
Invalid mode: #{mode_value} What it means
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.
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
Example fix
// before self.mode = 'batch' // after self.mode = :batch
Defensive patterns
Strategy: validation
Validate before calling
raise 'bad mode' unless [:batch, :individual_record].include?(mode)
Try / catch
rescue CanvasOperations::Errors::InvalidPropertyValue self.mode = :individual_record end
Prevention
- 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
When it happens
Trigger: Writing self.mode = :per_record or self.mode = 'batch' (String instead of Symbol) at the class level of a DataFixup subclass.
Common situations: Inventing a mode name not in VALID_MODES; passing the mode from config as a string; typos such as :individiual_record.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- progress_tracking must be a boolean
- Unsupported type_cast `#
- [Accessibility::CategoryBreakdownService] dropping unknown…
- an object with an interface for loading settings must be…
- an object with an interface for loading settings must be…
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/bfddf8156375a222.
Report an issue: GitHub.
Appendix: source
Thrown at lib/canvas_operations/data_fixup.rb:70
setting :processing_sleep_time, default: 0.1, type_cast: :to_f
before_run :ensure_validate_environment
before_run :ensure_valid_shard
class << self
# Get the current mode for this datafixup operation.
#
# @return [Symbol, nil] the current mode (:batch or :individual_record), or nil if not set
attr_reader :mode
# Set the mode in which the datafixup should operate.
#
# Must be one of the values defined in VALID_MODES.
# Use `self.mode = :batch` or `self.mode = :individual_record` at the class level.
#
# @param mode_value [Symbol] the mode to set (:batch or :individual_record)
def mode=(mode_value)
raise CanvasOperations::Errors::InvalidPropertyValue, "Invalid mode: #{mode_value}" unless VALID_MODES.include?(mode_value)
@mode = mode_value
end
# The ActiveRecord scope the datafixup should iterate over.
#
# Use `scope { Model.where(...) }` at the class level, or override this method
# for more complex logic that requires instance variables or methods.
def scope(&block)
if block_given?
@scope_block = block
else
@scope_block
end
end
# Get the current batch strategy for this datafixup operation.
#View on GitHub (pinned to 1c9f0bb801)