flippercloud/flipper · error · ArgumentError
#{object.inspect} cannot be converted into an expression
Error message
#{object.inspect} cannot be converted into an expression What it means
Error "#{object.inspect} cannot be converted into an expression" thrown in flippercloud/flipper.
Source
Thrown at lib/flipper/expression.rb:19
require "flipper/expression/builder"
require "flipper/expression/constant"
module Flipper
class Expression
include Builder
PruneResult = Struct.new(:expression, :constant_value, keyword_init: true)
private_constant :PruneResult
def self.build(object)
return object if object.is_a?(self) || object.is_a?(Constant)
case object
when Hash
name = object.keys.first
args = object.values.first
unless name
raise ArgumentError, "#{object.inspect} cannot be converted into an expression"
end
new(name, Array(args).map { |o| build(o) })
when String, Numeric, FalseClass, TrueClass
Expression::Constant.new(object)
when Symbol
Expression::Constant.new(object.to_s)
else
raise ArgumentError, "#{object.inspect} cannot be converted into an expression"
end
end
# Use #build
private_class_method :new
attr_reader :name, :function, :args
def initialize(name, args = [])View on GitHub (pinned to 1f86de3ec9)
Solutions
- Build the expression with Flipper::Expression builders (e.g. Flipper.expression(...)) or a supported Hash form
- Use the documented expression DSL instead of passing arbitrary objects
- Check the value type: only Hashes with valid operator keys and Expression objects are convertible
When it happens
Trigger: Thrown at lib/flipper/expression.rb:19 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/9d9f39aa8392ff97.
Report an issue: GitHub.