instructure/canvas-lms · error
No content importer registered for #
Error message
No content importer registered for #{context_type} What it means
Canvas maintains a registry of content importers keyed by the importer class's item_class name (registered via ContentImporter.register). content_importer_for looks up the registry by context_type string and raises when no importer has been registered under that key, meaning the requested context type has no importer capable of handling the migration.
Solutions
- Check the exact context_type string passed and compare it to registered keys (Importers.content_importers or the register calls in app/models/importers/*.rb)
- Ensure the importer class for that context is defined and loaded before lookup (eager_load / require the file)
- If the context type genuinely isn't importable, guard the call site and handle the unsupported type instead of raising
- For plugin-provided importers, verify the plugin is installed and enabled on the shard/account
Example fix
// before
klass = Importers.content_importer_for(context_type)
// after
klass = Importers.content_importer_for(context_type) rescue nil
return render_error('unsupported content type') unless klass Defensive patterns
Strategy: validation
Validate before calling
registered = Importers.content_importers rescue {}
raise 'unsupported context type' unless registered.key?(context_type) Type guard
def importable_context?(context_type) Importers.content_importer_for(context_type) rescue RuntimeError false end
Try / catch
begin
klass = Importers.content_importer_for(context_type)
rescue RuntimeError => e
render json: { error: "no importer for #{context_type}" }, status: :bad_request
end Prevention
- Centralize context_type constants instead of passing raw strings
- Ensure importer files are eager-loaded in all environments
- Cover every supported context type with a lookup test
When it happens
Trigger: Calling Importers.content_importer_for(context_type) with a context_type string that no importer registered — a typo, an unsupported context class, or the importer class never being loaded (e.g. in a context where plugin importers aren't required).
Common situations: Content migration requests targeting an account/course context whose importer plugin isn't installed; passing 'User' or another non-importable context; refactors renaming item_class so the registry key no longer matches the lookup string.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Needs self.item_class to be set in #
- A new_id, '# ', referenced an existing # and the # with #…
- A new_integration_id, '#
- A student referenced a non-existent user #
- An old_id, '# ', referenced a different # than the…
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/005d10c033cf4415.
Report an issue: GitHub.
Appendix: source
Thrown at app/models/importers.rb:28
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
module Importers
def self.register_content_importer(klass)
@content_importers ||= {}
@content_importers[klass.item_class.to_s] = klass
end
def self.content_importer_for(context_type)
klass = @content_importers&.[](context_type)
raise "No content importer registered for #{context_type}" unless klass
klass
end
def self.disable_live_events!
ActiveRecord::Base.observers.disable LiveEventsObserver
yield
ensure
enable_live_events!
end
def self.enable_live_events!
ActiveRecord::Base.observers.enable LiveEventsObserver
end
class Importer
class << self
attr_accessor :item_classView on GitHub (pinned to 1c9f0bb801)