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

Unable to create group set

Error message

Unable to create group set

What it means

In populate_group_category, the newly built GroupCategory fails to save (validations or callbacks reject it), and the mutation raises this GraphQL::ExecutionError. GroupCategories::ParamsPolicy populates the attributes from the input options, then SubmissionLifecycleManager wraps the save; a false return from save means invalid model state, not a permission problem.

Solutions

  1. Inspect @group_category.errors after the failed save (rails console or the mutation's GraphQL errors) to see which validation failed.
  2. Ensure name is present and unique within the course/group context.
  3. Validate the combination of self_signup, restrict_self_signup, enable_auto_leader, auto_leader_type — incompatible option pairs commonly fail ParamsPolicy population.
  4. Check group_limit / create_group_member_count are positive integers within account limits.
  5. Test the same inputs via console: GroupCategories::ParamsPolicy.new(cat, ctx).populate_with(options) then save, to reproduce and see errors.

Example fix

// before (invalid combo fails save)
createGroupSet(input: {name: "Groups", selfSignup: "restricted"})
// after (self-signup flags consistent)
createGroupSet(input: {name: "Groups", enableSelfSignup: true, restrictSelfSignup: true, selfSignup: "restricted"})
Defensive patterns

Strategy: validation

Validate before calling

# validate inputs before the mutation
course.group_categories.new(name: name).valid? or
options = { name:, self_signup:, auto_leader_type:, group_limit: }
probe = course.group_categories.build
GroupCategories::ParamsPolicy.new(probe, course).populate_with(options)
raise probe.errors.full_messages.join(', ') unless probe.valid?

Type guard

def valid_group_set_options?(options, context)
  cat = context.group_categories.build
  GroupCategories::ParamsPolicy.new(cat, context).populate_with(options)
  cat.valid?
end

Try / catch

rescue GraphQL::ExecutionError => e
  if e.message == 'Unable to create group set'
    Rails.logger.warn("group set save failed: #{cat&.errors&.full_messages}")
  end
end

Prevention

When it happens

Trigger: createGroupSet with an invalid name (blank, too long, duplicate in context), invalid self_signup/auto_leader_type/group_limit combinations, create_group_member_count or group_limit outside allowed bounds — anything making @group_category.save return false inside SubmissionLifecycleManager.with_executing_user.

Common situations: Passing self_signup without enable_self_signup consistency, group_limit over the account max, a name colliding with an existing group set in the same course, auto_leader_type set without enable_auto_leader, create_group_count above the 200 cap being silently clamped but member counts conflicting.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — 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/53cf62319837528a. Report an issue: GitHub.

Appendix: source

Thrown at app/graphql/mutations/create_group_set.rb:68

        assign_async: input[:assign_async],
        assign_unassigned_members: input[:assign_unassigned_members],
      }

      populate_group_category(options)
    else
      raise GraphQL::ExecutionError, "Insufficient permissions to create group set"
    end

    { group_set: @group_category }
  end

  # Private
  def populate_group_category(options)
    @group_category = GroupCategories::ParamsPolicy.new(@group_category, @context).populate_with(options)

    SubmissionLifecycleManager.with_executing_user(@current_user) do
      unless @group_category.save
        raise GraphQL::ExecutionError, "Unable to create group set"
      end
    end
  end

  def get_group_count(count)
    if count && count > 0
      [count, Setting.get("max_groups_in_new_category", "200").to_i].min
    else
      nil
    end
  end

  # The purpose of this method is to generate a list of valid contexts for the group set
  # based on the values in Types::GroupSetContextType
  # The context_fetcher requires a list of contexts that are capitalized on the first letter
  def valid_contexts
    Types::GroupSetContextType.values.values.map(&:value)
  end

View on GitHub (pinned to 1c9f0bb801)