instructure/canvas-lms · error · GraphQL::ExecutionError
not found
Error message
not found
What it means
Raised when no active InstitutionalTag with the given tag_id exists on this root account. Lookup is `InstitutionalTag.where(root_account_id:, workflow_state: "active").find_by(id: input[:tag_id])`, so deleted/inactive tags or wrong-account ids fail.
Solutions
- Verify the tag exists and is active: `InstitutionalTag.find_by(id:, root_account_id:, workflow_state: 'active')` in console.
- Create or re-activate the tag on the correct root account before calling the mutation.
- Use the correct global/relay id for the tag argument.
- Confirm you're operating on the same root account (shard) that owns the tag.
Example fix
// before
applyInstitutionalTag(input: { tagId: 123, userId: 456 }) # tag inactive or wrong account
// after: check first
tag = InstitutionalTag.find_by(id: 123, root_account_id: account.id, workflow_state: 'active')
# only call the mutation if tag present Defensive patterns
Strategy: validation
Validate before calling
tag = InstitutionalTag.find_by(id: tag_id, root_account_id: account.id, workflow_state: 'active') raise 'tag not found/inactive' unless tag
Try / catch
begin apply_tag(tag_id:, user_id:) rescue GraphQL::ExecutionError => e refresh_tag_list if e.message == 'not found' end
Prevention
- Fetch fresh tag lists before mutating
- Filter UI dropdowns to active tags only
- Never hardcode tag ids across environments
When it happens
Trigger: Passing a tag_id belonging to a different root account; the tag was deactivated (workflow_state != 'active') or deleted; tag_id is a legacy/global id not convertible by the relay/legacy id prepare function; typo'd or stale id cached on the client.
Common situations: Using a tag id from a test environment in prod; referencing a tag that was archived after being created; passing the internal DB id when the argument expects a relay/legacy prepared id; re-running an old automation script after the tag was deactivated.
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/5ae4585252900740.
Report an issue: GitHub.
Appendix: source
Thrown at app/graphql/mutations/apply_institutional_tag.rb:42
class ApplyInstitutionalTag < BaseMutation
argument :tag_id,
ID,
required: true,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("InstitutionalTag")
argument :user_id,
ID,
required: true,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("User")
field :institutional_tag_association, Types::InstitutionalTagAssociationType, null: true
def resolve(input:) # rubocop:disable GraphQL/UnusedArgument
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_edit)
tag = InstitutionalTag.where(root_account_id: root_account.id, workflow_state: "active").find_by(id: input[:tag_id])
raise GraphQL::ExecutionError, "not found" unless tag
user = root_account.all_users.find_by(id: input[:user_id])
raise GraphQL::ExecutionError, "not found" unless user
assoc = InstitutionalTagAssociation.find_or_initialize_by(
institutional_tag: tag,
context: user,
root_account:
)
assoc.workflow_state = "active"
if assoc.save
{ institutional_tag_association: assoc }
else
errors_for(assoc)
end
end
endView on GitHub (pinned to 1c9f0bb801)