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

cannot create collaborative groups in a non-collaborative…

Error message

cannot create collaborative groups in a non-collaborative group set

What it means

CreateGroupInSet#resolve raises this ExecutionError when the target GroupCategory is itself non_collaborative (a differentiation-tag set) and the caller attempts to create a regular collaborative group inside it. Set type and group type must match: collaborative groups cannot live in non-collaborative sets.

Solutions

  1. Pass non_collaborative: true when the target set is non-collaborative.
  2. Choose a collaborative group set instead if a standard group is intended.
  3. Filter non-collaborative sets out of group-set pickers for standard group creation.
  4. Fetch the group set (groupSet.nonCollaborative via GraphQL) and validate before submitting.

Example fix

// before
createGroupInSet({groupSetId, name})

// after
const set = await fetchGroupSet(groupSetId)
createGroupInSet({groupSetId, name, non_collaborative: set.nonCollaborative})
Defensive patterns

Strategy: validation

Validate before calling

const set = await fetchGroupSet(groupSetId)
if (!set.nonCollaborative && nonCollaborative) throw new Error('set/group type mismatch')
if (set.nonCollaborative && !nonCollaborative) throw new Error('collaborative group not allowed in tag set')

Type guard

const typeMatches = (set, nonCollaborative) => Boolean(set.nonCollaborative) === Boolean(nonCollaborative)

Prevention

When it happens

Trigger: createGroupInSet with non_collaborative: false (or omitted) targeting a group set where set.non_collaborative == true.

Common situations: User picks a differentiation-tag set in the group-set dropdown while the form defaults to creating a standard group; bulk-import scripts iterate all sets in a course including tag sets; UI predating differentiation tags not distinguishing set types.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/create_group_in_set.rb:43

  argument :name, String, required: true
  argument :non_collaborative, Boolean, required: false, default_value: false

  field :group, Types::GroupType, null: true

  def resolve(input:)
    category_id = GraphQLHelpers.parse_relay_or_legacy_id(input[:group_set_id], "GroupSet")
    set = GroupCategory.find(category_id)
    account = (set.context_type == "Account") ? set.context : set.context&.account
    verify_authorized_action!(set.context, :manage_groups_add)

    if input[:non_collaborative]
      if account&.allow_assign_to_differentiation_tags?
        raise GraphQL::ExecutionError, "insufficient permissions to create non-collaborative groups" unless set.context&.grants_right?(current_user, session, :manage_tags_add)
      else
        raise GraphQL::ExecutionError, "cannot create non-collaborative groups when the differentiation tags feature flag is disabled"
      end
    elsif set.non_collaborative
      raise GraphQL::ExecutionError, "cannot create collaborative groups in a non-collaborative group set"
    end

    group = set.groups.build(name: input[:name], context: set.context, non_collaborative: input[:non_collaborative])

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

View on GitHub (pinned to 1c9f0bb801)