{"record":{"id":"e1f68baa9bfd081c","repo":"instructure/canvas-lms","slug":"invalid-import-type-parameter","errorCode":null,"errorMessage":"invalid import type parameter","messagePattern":"invalid import type parameter","errorType":"validation","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/controllers/outcome_imports_api_controller.rb","lineNumber":168,"sourceCode":"  #         'https://<canvas>/api/v1/accounts/<account_id>/outcome_imports?import_type=instructure_csv'\n  #\n  #     curl -H 'Content-Type: text/csv' --data-binary @<filename>.csv \\\n  #         -H \"Authorization: Bearer <token>\" \\\n  #         'https://<canvas>/api/v1/courses/<course_id>/outcome_imports?import_type=instructure_csv'\n  #\n  #\n  # @argument extension [String]\n  #   Recommended for raw post request style imports. This field will be used to\n  #   distinguish between csv and other file format extensions that\n  #   would usually be provided with the filename in the multipart post request\n  #   scenario. If not provided, this value will be inferred from the\n  #   Content-Type, falling back to csv-file format if all else fails.\n  #\n  # @returns OutcomeImport\n  def create\n    if authorized_action(@context, @current_user, :import_outcomes)\n      params[:import_type] ||= \"instructure_csv\"\n      raise \"invalid import type parameter\" unless OutcomeImport.valid_import_type?(params[:import_type])\n\n      file_obj = if params.key?(:attachment)\n                   params[:attachment]\n                 else\n                   body_file\n                 end\n\n      import = OutcomeImport.create_with_attachment(\n        @context, params[:import_type], file_obj, @current_user, params[:learning_outcome_group_id]\n      )\n      import.schedule\n\n      render json: outcome_import_json(import, @current_user, session)\n    end\n  end\n\n  # @API Get Outcome import status\n  #","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/controllers/outcome_imports_api_controller.rb#L150-L186","documentation":"OutcomeImportsApiController#create raises a plain RuntimeError when the supplied import_type is not a registered OutcomeImport import type. The API only accepts import types the OutcomeImport model validates (defaulting to 'instructure_csv').","triggerScenarios":"POST /api/v1/accounts/:id/outcome_imports (or courses equivalent) with import_type set to an unknown value like 'academic_csv' typo'd or unsupported for the install, or nil resolving to a type not enabled.","commonSituations":"Copy-pasting API examples using import types from other Canvas features; plugins defining import types not enabled; clients omitting import_type while sending a non-CSV body and assuming another format is inferred.","solutions":["Send import_type=instructure_csv (the only universally supported value) in the request params.","Check OutcomeImport.valid_import_type?(type) client-side before calling the API.","Confirm any custom import types are registered in OutcomeImport on the target Canvas install.","Provide the outcome data as CSV matching the instructure_csv format when unsure."],"exampleFix":"// before\nPOST outcome_imports?import_type=csv  // invalid\n// after\nPOST outcome_imports?import_type=instructure_csv","handlingStrategy":"validation","validationCode":"raise ArgumentError unless OutcomeImport.valid_import_type?(import_type)","typeGuard":null,"tryCatchPattern":"begin\n  create_outcome_import(import_type: 'instructure_csv', attachment: csv_file)\nrescue RuntimeError => e\n  retry with import_type: 'instructure_csv' if e.message == 'invalid import type parameter'\nend","preventionTips":["Default to import_type=instructure_csv unless you know a custom type is registered.","Check valid_import_type? before calling the API.","Read the OutcomeImport model to see which types your install supports.","Don't rely on Content-Type sniffing; always send an explicit import_type."],"tags":["api","outcome-imports","validation"],"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"}