instructure/canvas-lms · error · GraphQL::ExecutionError

not found

Error message

not found

What it means

CreateInstitutionalTagCategory rescues ActiveRecord::RecordNotFound and re-raises it as this 'not found' GraphQL::ExecutionError. Nothing in the happy path calls find; this is almost always the argument ID preparation (relay/legacy id helper) or a nested lookup raising RecordNotFound, converted into a GraphQL error.

Solutions

  1. Verify all ID arguments are well-formed InstitutionalTagCategory global IDs.
  2. Check shard/scope: the ID must resolve in the current account's shard.
  3. Fetch a fresh category via the institutionalTagCategories query and reuse its ID.
  4. If it persists, log the raised ActiveRecord::RecordNotFound message (GraphQL error extensions/traces) to identify the exact lookup that failed.

Example fix

// before
createInstitutionalTagCategory(input: { name: "Difficulty" }) // with a corrupt custom context id raising RecordNotFound
// after
const ctx = { domainRootAccount: account }; // ensure valid GraphQL context
createInstitutionalTagCategory({ variables: { name: 'Difficulty', description: 'Levels' } })
Defensive patterns

Strategy: try-catch

Type guard

function isWellFormedId(id) {
  return typeof id === 'string' && /^[A-Za-z]+-\d+$/.test(id); // basic global-id shape check
}

Try / catch

try {
  await createInstitutionalTagCategory({ variables })
} catch (e) {
  if (e.message === 'not found') {
    // inspect request variables; a RecordNotFound was converted — validate every ID argument
  }
}

Prevention

When it happens

Trigger: An invalid or foreign global ID supplied in a related argument processed by ID preparation helpers, or any find!-style lookup inside resolve failing — though for this mutation, creation-only, the ID preparer is the usual source.

Common situations: Malformed relay ID strings; IDs from the wrong shard; a client sending legacy numeric IDs where global IDs are expected (or vice versa) with a mismatched prepare function.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/create_institutional_tag_category.rb:48

    def resolve(input:)
      root_account = context[:domain_root_account]
      raise GraphQL::ExecutionError, "feature flag is disabled" unless root_account.feature_enabled?(:institutional_tags)
      raise GraphQL::ExecutionError, "not authorized" unless root_account.grants_right?(current_user, session, :manage_institutional_tags_create)

      category = root_account.institutional_tag_categories.new(
        name: input[:name],
        description: input[:description]
      )

      if category.save
        { institutional_tag_category: category }
      else
        errors_for(category)
      end
    rescue ActiveRecord::RecordInvalid
      errors_for(category)
    rescue ActiveRecord::RecordNotFound
      raise GraphQL::ExecutionError, "not found"
    end
  end
end

View on GitHub (pinned to 1c9f0bb801)