instructure/canvas-lms · error
Invalid version (# ) specified!
Error message
Invalid version (#{version.inspect}) specified! What it means
simply_versioned's versioning options validate the :limit/:when combination passed to simply_versioned. Raising 'Invalid version (X) specified!' means the version spec supplied (e.g. a number of versions or a hash like unmodified: n) did not match any accepted shape. It is an argument validation error at model class-definition/load time.
Solutions
- Read the inspect-ed value in the message and compare against documented :when/:limit options in simply_versioned.rb
- Fix the model's simply_versioned call to use the accepted option shapes (e.g. when: {unmodified: 30.minutes})
- Pin/upgrade the gem to match the syntax your models use
- Add a spec that boots the model class to catch config regressions early
Example fix
// before
simply_versioned when: 5
// after
simply_versioned when: {unmodified: 30.minutes} Defensive patterns
Strategy: validation
Validate before calling
valid = opts[:when].is_a?(Hash) && (opts[:when][:unmodified] || opts[:when][:maximum]) raise ArgumentError, 'bad simply_versioned options' unless valid || opts.empty?
Type guard
def valid_version_opts?(o) o.is_a?(Hash) && (o[:when].nil? || o[:when].is_a?(Hash)) end
Prevention
- Copy option syntax from the gem version in your Gemfile.lock
- Add a spec that eager-loads all versioned models
- Watch gem changelogs on upgrade for option format changes
When it happens
Trigger: Declaring simply_versioned in a model with a malformed :when option (e.g. simply_versioned when: 5 without required keys, or an unsupported value type) at class load time.
Common situations: Upgrading the simply_versioned gem and old option syntax no longer accepted; typos in the when/limit hash keys; copying configuration from an incompatible gem version.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- A new_id, '# ', referenced an existing # and the # with #…
- A new_integration_id, '#
- A student referenced a non-existent user #
- A user did not pass validation
- [A11Y Scan] Skipped resource #
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/33f9ab817e1a0136.
Report an issue: GitHub.
Appendix: source
Thrown at gems/simply_versioned/lib/simply_versioned.rb:146
def revert_to_version(version, options = {})
options.reverse_merge!({
except: [:created_at, :updated_at]
})
version = case version
when Version
version
when Integer
versions.where(number: version).first
end
raise "Invalid version (#{version.inspect}) specified!" unless version
options[:except] = options[:except].map(&:to_s)
update(YAML.load(version.yaml).except(*options[:except]))
(options[:versioned_associations] || DEFAULTS[:versioned_associations]).each do |va|
restore_associations_from_version(version, va)
end
endView on GitHub (pinned to 1c9f0bb801)