{"record":{"id":"6e46f7bd195aabaf","repo":"instructure/canvas-lms","slug":"model-id-must-be-a-string","errorCode":null,"errorMessage":"Model ID must be a string","messagePattern":"Model ID must be a string","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"app/models/llm_config.rb","lineNumber":64,"sourceCode":"      substitutions.each do |placeholder_prefix, sub_value|\n        new_options[key] = value.gsub(\"<#{placeholder_prefix}_PLACEHOLDER>\", sub_value.to_s) if value.is_a?(String)\n      end\n    end\n\n    new_options.each_value do |value|\n      if value.is_a?(String) && (remaining_placeholder = value.match(/<\\w+_PLACEHOLDER>/))\n        raise ArgumentError, \"Options still contain placeholder: #{remaining_placeholder[0]}\"\n      end\n    end\n\n    [new_template, new_options]\n  end\n\n  private\n\n  def validate!\n    raise ArgumentError, \"Name must be a string\" unless @name.is_a?(String)\n    raise ArgumentError, \"Model ID must be a string\" unless @model_id.is_a?(String)\n    raise ArgumentError, \"Rate limit must be either nil, or hash with :limit and :period keys\" unless @rate_limit.nil? || (@rate_limit.is_a?(Hash) && @rate_limit.keys == %i[limit period])\n    raise ArgumentError, \"Template must be a string\" unless @template.is_a?(String)\n    raise ArgumentError, \"Options must be a hash\" unless @options.is_a?(Hash)\n  end\nend\n","sourceCodeStart":46,"sourceCodeEnd":70,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/models/llm_config.rb#L46-L70","documentation":"Guard in RruleHelper#parse_bymonthday: a yearly RRULE's BYMONTHDAY contains more than one day (comma-separated list), which Canvas's recurring calendar events do not support. Raises RruleValidationError — an input-validation sentinel against the user-supplied RRULE string.","triggerScenarios":"LlmConfig.new(name, model_id where model_id is nil, symbol, hash, etc.) — any non-String model identifier.","commonSituations":"YAML keys parsed as symbols; nil model ids from incomplete config files; passing a model object instead of its id string.","solutions":["Pass model_id as a String.","Convert numeric or symbolic ids with .to_s before constructing the config.","Validate the model registry/config file so every entry has a string model id."],"exampleFix":"// before\nLlmConfig.new(\"gpt4\", :gpt_4, nil, template, {})\n// after\nLlmConfig.new(\"gpt4\", \"gpt-4\", nil, template, {})","handlingStrategy":"type-guard","validationCode":"raise ArgumentError, \"model_id must be String\" unless model_id.is_a?(String)\ncfg = LlmConfig.new(name, model_id, ...)","typeGuard":"def valid_model_id?(v) = v.is_a?(String)","tryCatchPattern":"begin\n  cfg = LlmConfig.new(name, model_id, ...)\nrescue ArgumentError => e\n  Rails.logger.error(\"Invalid LlmConfig: #{e.message}\")\n  raise\nend","preventionTips":["Call .to_s on ids coming from symbols or numbers","Assert model ids in the config registry are strings in a startup check"],"tags":["argumenterror","validation","llm-config"],"backgroundTag":"invalid-constructor-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"}