{"record":{"id":"d94ec53a825c32f6","repo":"instructure/canvas-lms","slug":"content-export-for-outcomes-service-failed","errorCode":null,"errorMessage":"Content Export for Outcomes Service failed","messagePattern":"Content Export for Outcomes Service failed","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/models/outcomes_service/migration_service.rb","lineNumber":67,"sourceCode":"          { export_id: json[\"id\"], course: }\n        else\n          raise \"Error queueing export for Outcomes Service: #{response.body}\"\n        end\n      end\n\n      def export_completed?(export_data)\n        content_export_url = \"#{OutcomesService::Service.url(export_data[:course])}/api/content_exports/#{export_data[:export_id]}\"\n        response = CanvasHttp.get(\n          content_export_url,\n          headers_for(export_data[:course], \"content_migration.export\", id: export_data[:export_id])\n        )\n        if /^2/.match?(response.code.to_s)\n          json = JSON.parse(response.body)\n          case json[\"state\"]\n          when \"completed\"\n            true\n          when \"failed\"\n            raise \"Content Export for Outcomes Service failed\"\n          else\n            false\n          end\n        else\n          raise \"Error retrieving export state for Outcomes Service: #{response.body}\"\n        end\n      end\n\n      def retrieve_export(export_data)\n        content_export_url = \"#{OutcomesService::Service.url(export_data[:course])}/api/content_exports/#{export_data[:export_id]}\"\n        response = CanvasHttp.get(\n          content_export_url,\n          headers_for(export_data[:course], \"content_migration.export\", id: export_data[:export_id])\n        )\n        if /^2/.match?(response.code.to_s)\n          json = JSON.parse(response.body)\n          json[\"data\"]\n        else","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/models/outcomes_service/migration_service.rb#L49-L85","documentation":"export_completed? polls the outcomes service content_exports API. A 2xx response with json[\"state\"] == 'failed' means the remote export job failed, so it raises 'Content Export for Outcomes Service failed'.","triggerScenarios":"Polling an export whose remote content export transitioned to state 'failed' on the outcomes service side.","commonSituations":"Remote export crashed (bad course data, internal error); export id from a previously failed run being re-polled.","solutions":["Check the outcomes service logs for the export id to find the remote failure cause","Queue a new export via begin_export and retry the migration","Fix any course/content data problems reported remotely before retrying"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  done = MigrationService.export_completed?(export_data)\nrescue RuntimeError => e\n  raise unless e.message == 'Content Export for Outcomes Service failed'\n  Canvas::Errors.capture(e)\n  # mark migration failed, optionally begin a new export\nend","preventionTips":["Check remote export state/logs via service UI when this raise fires","Treat as terminal — re-queue a fresh export rather than re-polling","Alert on 'failed' export states from the outcomes service"],"tags":["ruby","http","outcomes-service","export"],"backgroundTag":"api-error-response","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"}