flippercloud/flipper · error · ArgumentError

actor cannot be nil

Error message

actor cannot be nil

What it means

Error "actor cannot be nil" thrown in flippercloud/flipper.

Source

Thrown at lib/flipper/types/actor.rb:12

module Flipper
  module Types
    class Actor < Type
      def self.wrappable?(actor)
        return false if actor.nil?
        actor.respond_to?(:flipper_id)
      end

      attr_reader :actor

      def initialize(actor)
        raise ArgumentError, 'actor cannot be nil' if actor.nil?

        unless actor.respond_to?(:flipper_id)
          raise ArgumentError, "#{actor.inspect} must respond to flipper_id, but does not"
        end

        @actor = actor
        @value = actor.flipper_id.to_s
      end

      def respond_to?(*args)
        super || @actor.respond_to?(*args)
      end

      if RUBY_VERSION >= '3.0'
        def method_missing(name, *args, **kwargs, &block)
          @actor.send name, *args, **kwargs, &block
        end
      else

View on GitHub (pinned to 1f86de3ec9)

Solutions

  1. Guard against nil before wrapping: only call Flipper::Actor.new(user) when user is present
  2. Use Flipper.enabled?(:feature, current_user) only when current_user is not nil
  3. Handle anonymous users explicitly instead of passing nil as the actor

When it happens

Trigger: Thrown at lib/flipper/types/actor.rb:12 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of flippercloud/flipper@1f86de3ec9 (2026-08-23). Data as JSON: /api/errors/1a5672ca7c6265ee. Report an issue: GitHub.