{"record":{"id":"a63dcf7860699c49","repo":"ruby-concurrency/concurrent-ruby","slug":"value-value-class-value-message-any-o","errorCode":null,"errorMessage":"Value (#{value.class}) '#{value}' #{message} any of: #{types.join('; ')}.","messagePattern":"Value \\(#(.+?)\\) '#(.+?)' #(.+?) any of: #(.+?)\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/concurrent-ruby-edge/concurrent/actor/type_check.rb","lineNumber":42,"sourceCode":"            TypeCheck.error(value, 'is not matching', types)\n        value\n      end\n\n      def Child?(value, *types)\n        Type?(value, Class) &&\n            types.any? { |t| value <= t }\n      end\n\n      def Child!(value, *types)\n        Child?(value, *types) or\n            TypeCheck.error(value, 'is not child', types)\n        value\n      end\n\n      private\n\n      def self.error(value, message, types)\n        raise TypeError,\n              \"Value (#{value.class}) '#{value}' #{message} any of: #{types.join('; ')}.\"\n      end\n    end\n  end\nend\n\n","sourceCodeStart":24,"sourceCodeEnd":49,"githubUrl":"https://github.com/ruby-concurrency/concurrent-ruby/blob/0b88d5ff75f69b3740c8f0868e76f833cb2fd45d/lib/concurrent-ruby-edge/concurrent/actor/type_check.rb#L24-L49","documentation":"Concurrent::Actor::TypeCheck provides the bang helpers `Type!`, `Match!`, and `Child!` used throughout the Edge Actor internals (e.g. `initialize_core` requires a `Core`; spawn validates names and classes). When a value fails the allowed-type test, `TypeCheck.error` raises TypeError with a composed message naming the value's class, the value itself, the failure kind ('is not' for Type!, 'is not matching' for Match!, 'is not child' for Child!), and the accepted types. `Type?` checks `value.is_a?(t)`, `Match?` uses `t === value`, and `Child?` requires value to be a Class with `value <= t`.","triggerScenarios":"Passing a wrong-typed value into an Actor API that type-checks: a non-Reference where a Concurrent::Actor::Reference is required, a non-String/Symbol actor name, or calling `Child!(MyClass, Concurrent::Actor::Context)` when MyClass does not inherit Context (Child! additionally demands the value be a Class at all). Also raised from your own code when you include Concurrent::Actor::TypeCheck and call the bang helpers with a failing value.","commonSituations":"Wrapping actor references in decorator/delegate objects and passing the wrapper where the real Reference is required; version skew between concurrent-ruby and concurrent-ruby-edge where internal constants moved; duck-typed classes that never actually subclass the required base.","solutions":["Read the message: it lists the accepted types — convert or replace the value with one of those types.","If the check was Child!, make the value a Class that inherits (or includes) an accepted type, e.g. `class MyWorker < Concurrent::Actor::Context`.","If the check was Type!/Match!, pass an instance matching one of the listed types.","Pin matching versions of concurrent-ruby and concurrent-ruby-edge in your Gemfile so class identities line up."],"exampleFix":"// before\nChild!(MyWorker, Concurrent::Actor::Context)\n# MyWorker is a plain class ->\n# Value (Class) 'MyWorker' is not child any of: Concurrent::Actor::Context.\n\n// after\nclass MyWorker < Concurrent::Actor::Context; end\nChild!(MyWorker, Concurrent::Actor::Context)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def type_check_ok?(value, *types)\n  types.any? { |t| value.is_a?(t) }\nend\n\ndef child_check_ok?(value, *types)\n  value.is_a?(Class) && types.any? { |t| value <= t }\nend","tryCatchPattern":"begin\n  Child!(klass, Concurrent::Actor::Context)\nrescue TypeError => e\n  # e.message lists accepted types; wrap value in an adapter or fix the caller\n  raise InvalidActorInput, e.message\nend","preventionTips":["Call the non-bang predicates (Type?, Match?, Child?) first — they return true/false without raising.","Pass library classes (Reference, Core, Context) themselves, not wrapper objects.","Pin concurrent-ruby and concurrent-ruby-edge to a compatible version pair."],"tags":["concurrent-ruby","concurrent-ruby-edge","typecheck","typeerror","actor"],"backgroundTag":"type-validation-failed","analyzedSha":"0b88d5ff75f69b3740c8f0868e76f833cb2fd45d","analyzedAt":"2026-08-21T20:12:56.291Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}