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

group not found

Error message

group not found

What it means

ImportOutcomes raises this when a groupId was supplied but no active LearningOutcomeGroup with that id exists. The lookup is LearningOutcomeGroup.active.find_by(id: group_id), so soft-deleted (workflow_state != 'active') groups also produce this error.

Solutions

  1. Verify the group exists and is active: LearningOutcomeGroup.active.find_by(id:) in rails console
  2. Re-list outcome groups via GraphQL (learningOutcomeGroups or context outcomes query) and use a fresh id
  3. Check root account/shard scoping of the id
  4. If the group was deleted, import its parent group or recreate/restore it first

Example fix

// before
importOutcomes(input: { groupId: "404-group", targetGroupId: "5" })
// after: pick an active group id from a fresh query
const groups = await account.outcomesGroupsConnection; // active only
importOutcomes(input: { groupId: groups[0].id, targetGroupId: "5" });
Defensive patterns

Strategy: validation

Validate before calling

const g = await graphqlClient.node(toGlobalId("LearningOutcomeGroup", groupId));
if (!g || g.workflowState !== "active") throw new Error("group not found or inactive");

Try / catch

try {
  await importOutcomes({ groupId, ...target });
} catch (e) {
  if (e.message === "group not found") {
    // re-fetch the group list and let the user pick a new source group
  }
}

Prevention

When it happens

Trigger: Calling importOutcomes with groupId of a deleted or inactive outcome group, an id from a different account/shard, a typo'd id, or passing a ContentTag/outcome id instead of a group id.

Common situations: Group was deleted by a user between fetching the list and importing; using ids from an unrelated root account; stale UI caches pointing at removed groups; confusing outcome ids with group ids in the payload.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/import_outcomes.rb:73

          attribute: "sourceContextId"
        )
      end
    elsif input[:source_context_id].present?
      return validation_error(
        I18n.t("sourceContextType required if sourceContextId provided"),
        attribute: "sourceContextType"
      )
    end

    target_context, target_group = get_target(input)

    verify_authorized_action!(target_context, :manage_outcomes)

    if (group_id = input[:group_id].presence)
      # Import the entire group into the given context
      group = LearningOutcomeGroup.active.find_by(id: group_id)
      if group.nil?
        raise GraphQL::ExecutionError, I18n.t("group not found")
      end

      # If optional source context provided, then check that
      # matches the group's context
      source_context ||= group.context
      if source_context && source_context != group.context
        raise GraphQL::ExecutionError, I18n.t("source context does not match group context")
      end

      # source has to be global or in an associated account
      unless !source_context || target_context.associated_accounts.include?(source_context)
        raise GraphQL::ExecutionError, I18n.t("invalid context for group")
      end

      # source can't be a root group
      if group.learning_outcome_group_id.nil?
        raise GraphQL::ExecutionError, I18n.t("cannot import a root group")
      end

View on GitHub (pinned to 1c9f0bb801)