mongodb/mongoid · error

Around callbacks are disabled for embedded documents. Skippi

Error message

Around callbacks are disabled for embedded documents. Skipping around callbacks for #{child.class.name}.

What it means

Error "Around callbacks are disabled for embedded documents. Skipping around callbacks for #{child.class.name}." thrown in mongodb/mongoid.

Source

Thrown at lib/mongoid/interceptable.rb:231

      value
    end

    # Execute the before callbacks of given kind for embedded documents.
    #
    # @param [ Symbol ] kind The type of callback to execute.
    # @param [ Array<Document> ] children Children to execute callbacks on.
    # @param [ Array<ActiveSupport::Callbacks::CallbackSequence, ActiveSupport::Callbacks::Filters::Environment> ] callback_list List of
    #   pairs of callback sequence and environment. This list will be later used
    #   to execute after callbacks in reverse order.
    #
    # @api private
    def _mongoid_run_child_before_callbacks(kind, children: [], callback_list: [])
      children.each do |child|
        chain = child.__callbacks[child_callback_type(kind, child)]
        env = ActiveSupport::Callbacks::Filters::Environment.new(child, false, nil)
        next_sequence = compile_callbacks(chain)
        unless next_sequence.final?
          Mongoid.logger.warn("Around callbacks are disabled for embedded documents. Skipping around callbacks for #{child.class.name}.")
          Mongoid.logger.warn('To enable around callbacks for embedded documents, set Mongoid::Config.around_callbacks_for_embeds to true.')
        end
        next_sequence.invoke_before(env)
        return false if env.halted

        env.value = !env.halted
        callback_list << [ next_sequence, env ]
      end
      callback_list
    end

    # Execute the after callbacks.
    #
    # @param [ Array<ActiveSupport::Callbacks::CallbackSequence, ActiveSupport::Callbacks::Filters::Environment> ] callback_list List of
    #   pairs of callback sequence and environment.
    def _mongoid_run_child_after_callbacks(callback_list: [])
      callback_list.reverse_each do |next_sequence, env|
        next_sequence.invoke_after(env)

View on GitHub (pinned to 0da0e23d71)

When it happens

Trigger: Thrown at lib/mongoid/interceptable.rb:231 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mongodb/mongoid@0da0e23d71 (2026-08-23). Data as JSON: /api/errors/8d079e2e7bcab0de. Report an issue: GitHub.