{"record":{"id":"33f9ab817e1a0136","repo":"instructure/canvas-lms","slug":"invalid-version-version-inspect-specified","errorCode":null,"errorMessage":"Invalid version (#{version.inspect}) specified!","messagePattern":"Invalid version \\(#(.+?)\\) specified!","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gems/simply_versioned/lib/simply_versioned.rb","lineNumber":146,"sourceCode":"def revert_to_version(version, options = {})\n  options.reverse_merge!({\n    except: [:created_at, :updated_at]\n  })\n\n  version = case version\n            when Version\n              version\n            when Integer\n              versions.where(number: version).first\n            end\n\n  raise \"Invalid version (#{version.inspect}) specified!\" unless version\n\n  options[:except] = options[:except].map(&:to_s)\n\n  update(YAML.load(version.yaml).except(*options[:except]))\n  (options[:versioned_associations] || DEFAULTS[:versioned_associations]).each do |va|\n    restore_associations_from_version(version, va)\n  end\nend","sourceCodeStart":null,"sourceCodeEnd":null,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/gems/simply_versioned/lib/simply_versioned.rb#L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nsimply_versioned when: 5\n// after\nsimply_versioned when: {unmodified: 30.minutes}","handlingStrategy":"validation","validationCode":"valid = opts[:when].is_a?(Hash) && (opts[:when][:unmodified] || opts[:when][:maximum])\nraise ArgumentError, 'bad simply_versioned options' unless valid || opts.empty?","typeGuard":"def valid_version_opts?(o)\n  o.is_a?(Hash) && (o[:when].nil? || o[:when].is_a?(Hash))\nend","tryCatchPattern":null,"preventionTips":["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"],"tags":["ruby","gem","versioning","invalid-options"],"backgroundTag":"invalid-argument-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"}