{"record":{"id":"ec9bbdd7c445cad5","repo":"instructure/canvas-lms","slug":"invalid-field-type","errorCode":null,"errorMessage":"Invalid %{field}: \"%{type}\"","messagePattern":"Invalid %(.+?): \"%(.+?)\"","errorType":"validation","errorClass":"InvalidDataError","httpStatus":null,"severity":"error","filePath":"lib/outcomes/import.rb","lineNumber":64,"sourceCode":"          '\"%{field}\" must be either \"%{active}\" or \"%{deleted}\"',\n          field: \"workflow_state\",\n          active: \"active\",\n          deleted: \"deleted\"\n        )\n      end\n    end\n\n    def import_object(object)\n      check_object(object)\n\n      type = object[:object_type]\n      case type\n      when \"outcome\"\n        import_outcome(object)\n      when \"group\"\n        import_group(object)\n      else\n        raise InvalidDataError, I18n.t(\n          'Invalid %{field}: \"%{type}\"',\n          field: \"object_type\",\n          type:\n        )\n      end\n    end\n\n    def import_group(group)\n      invalid = group.keys.select do |k|\n        group[k].present? && OBJECT_ONLY_FIELDS.include?(k)\n      end\n      if invalid.present?\n        raise InvalidDataError, I18n.t(\n          \"Invalid fields for a group: %{invalid}\",\n          invalid: invalid.map(&:to_s).inspect\n        )\n      end\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/outcomes/import.rb#L46-L82","documentation":"import_object dispatches on object[:object_type] and only supports 'outcome' and 'group'. Any other value (including nil or a non-string) falls to the else branch and raises this error naming the offending type. The field must be a plain lowercase string, not a symbol or capitalized variant.","triggerScenarios":"import_object with object[:object_type] == 'Outcome', 'learning_outcome_group', 'objective', or missing entirely (type is then nil and appears quoted as \"\" in the message). Also triggered when the value is a symbol :outcome instead of the string 'outcome'.","commonSituations":"Hand-written import JSON/CSV where object_type was renamed or omitted; generators that emit capitalized type names; clients mixing Canvas API terminology ('group' vs 'outcome_group') with this importer's vocabulary.","solutions":["Set object_type to exactly 'outcome' or 'group' (lowercase string).","Default or map unknown/missing object_type before calling import_object, e.g. from a 'type' column in your source data.","Validate the payload against the allowed set ['outcome','group'] before starting the import."],"exampleFix":"// before\n{ object_type: 'Objective', ... }\n// after\n{ object_type: 'outcome', ... }","handlingStrategy":"validation","validationCode":"raise ArgumentError, \"object_type must be outcome or group\" unless %w[outcome group].include?(object[:object_type].to_s)","typeGuard":"def valid_object_type?(t)\n  %w[outcome group].include?(t)\nend","tryCatchPattern":"begin\n  importer.import_object(object)\nrescue Outcomes::Import::InvalidDataError => e\n  errors << {row: object, reason: e.message}\nend","preventionTips":["Always emit lowercase string 'outcome' or 'group' from your generator","Fail fast on the first bad row instead of mid-import","Map client-side type names to importer vocabulary in one place"],"tags":["validation","enum","dispatch","outcomes-import"],"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"}