instructure/canvas-lms · error · UnsupportedTypeError

don't know how to load #

Error message

don't know how to load #{type}

What it means

graphql_node_loader maps node type names to loader lambdas. If a type reaches the loader that has no registered branch (e.g. due to a typo in the node id's encoded type or an unregistered type), it raises UnsupportedTypeError 'don't know how to load <type>'.

Solutions

  1. Use ids returned from other GraphQL fields instead of hand-constructing them.
  2. Verify the type name inside the gid matches a type registered in graphql_node_loader.rb.
  3. If the branch is feature-gated (e.g. institutional_tags), enable the feature flag on the root account.

Example fix

// before
node(id: Buffer.from('TagCategory-3').toString('base64')) // type not registered
// after
node(id: <gid returned by a previous GraphQL query>)
Defensive patterns

Strategy: validation

Validate before calling

function gidType(gid){ try { return UniqueWithinType.decode(gid)[0] } catch { return null } }
if (!REGISTERED_NODE_TYPES.includes(gidType(id))) throw new Error(`node loader does not handle type ${gidType(id)}`)

Type guard

function isLoadableNode(gid){ const t = gidType(gid); return !!t && REGISTERED_NODE_TYPES.includes(t) }

Try / catch

try { const node = await client.request(NODE_QUERY, {id}) } catch (e) { if (e.message.includes('don't know how to load')) { /* use a gid from a prior query instead */ } else throw e }

Prevention

When it happens

Trigger: Querying node(id:) with a Relay id whose decoded type is not handled by the loader (typo'd or hand-encoded gid), or a feature like institutional_tags gating a branch so unlisted types fall to the else.

Common situations: Clients constructing global ids manually with an invalid type string; schema changes where a type was renamed but cached ids persist; loading nodes for types whose loader requires a feature flag the account lacks (falls through to else).

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/eb4793d9a9c65a74. Report an issue: GitHub.

Appendix: source

Thrown at app/graphql/graphql_node_loader.rb:352

      end
    when "InstitutionalTag"
      Loaders::IDLoader.for(InstitutionalTag).load(id).then do |tag|
        next nil unless ctx[:domain_root_account]&.feature_enabled?(:institutional_tags)
        next nil unless ctx[:domain_root_account]&.grants_right?(ctx[:current_user], ctx[:session], :manage_institutional_tags_view)

        tag
      end
    when "InstitutionalTagAssociation"
      Loaders::IDLoader.for(InstitutionalTagAssociation).load(id).then(check_read_permission)
    when "InstitutionalTagCategory"
      Loaders::IDLoader.for(InstitutionalTagCategory).load(id).then do |category|
        next nil unless ctx[:domain_root_account]&.feature_enabled?(:institutional_tags)
        next nil unless ctx[:domain_root_account]&.grants_right?(ctx[:current_user], ctx[:session], :manage_institutional_tags_view)

        category
      end
    else
      raise UnsupportedTypeError, "don't know how to load #{type}"
    end
  end

  def self.make_permission_check(ctx, *permissions)
    lambda do |o|
      o&.grants_any_right?(ctx[:current_user], ctx[:session], *permissions) ? o : nil
    end
  end

  class UnsupportedTypeError < StandardError; end
end

View on GitHub (pinned to 1c9f0bb801)