gitlabhq/gitlabhq · error · Gitlab::Graphql::Errors::ArgumentError

Only project level work items can be created to resolve note

Error message

Only project level work items can be created to resolve noteable discussions

What it means

Thrown by `WorkItems::Create#check_feature_available!` when the container is a `Group` and `params[:merge_request_to_resolve_discussions_object]` is set — i.e. the caller passed `discussionsToResolve` while targeting `namespacePath` (a group). Resolving merge request discussions by creating an item is only implemented at project level, so the mutation rejects the combination before checking allowed work item types.

Source

Thrown at app/graphql/mutations/work_items/create.rb:149

          widget_params: widget_params
        ).execute

        check_spam_action_response!(create_result[:work_item]) if create_result[:work_item]

        {
          work_item: create_result.success? ? create_result[:work_item] : nil,
          errors: create_result.errors
        }
      end

      private

      # Overridden on EE
      def check_feature_available!(container, type, params)
        return unless container.is_a?(::Group)

        if params[:merge_request_to_resolve_discussions_object]
          raise Gitlab::Graphql::Errors::ArgumentError,
            _('Only project level work items can be created to resolve noteable discussions')
        end

        return if container.allowed_work_item_type?(type.base_type)

        raise_resource_not_available_error!
      end

      def params_with_resolve_discussion_params(attributes)
        discussion_attributes = attributes.delete(:discussions_to_resolve)
        return attributes if discussion_attributes.blank?

        noteable = discussion_attributes[:noteable_id].find
        unless noteable.is_a?(::MergeRequest)
          raise Gitlab::Graphql::Errors::ArgumentError,
            _('Only Merge Requests are allowed as a noteable to resolve discussions of at the moment.')
        end

View on GitHub (pinned to 55ee20384a)

Solutions

  1. Send `projectPath` of the merge request's project instead of `namespacePath` when resolving discussions.
  2. Derive the container from the noteable's project when `discussionsToResolve` is present.
  3. Hide the resolve-discussion affordance in group-level create forms.

Example fix

# before
workItemCreate(namespacePath: "group-x", discussionsToResolve: { noteableId: mr_gid, discussionId: d })
# after
workItemCreate(projectPath: mr.project.full_path, discussionsToResolve: { noteableId: mr_gid, discussionId: d })
Defensive patterns

Strategy: validation

Validate before calling

if input[:discussions_to_resolve]
  raise ArgumentError, 'use projectPath' unless container.is_a?(Project)
end

Prevention

When it happens

Trigger: Calling `workItemCreate(namespacePath: "group", discussionsToResolve: { noteableId: "gid://gitlab/MergeRequest/1", discussionId: "..." }, ...)`.

Common situations: A 'create issue from discussion' action executed while the user's context/selector is a group instead of the MR's project; generic create forms that always send `namespacePath` and treat `discussionsToResolve` as optional.

Related errors


AI-assisted analysis of gitlabhq/gitlabhq@55ee20384a (2026-08-21). Data as JSON: /api/errors/533a0e0ae92b8d9a. Report an issue: GitHub.