ruby/rubygems · error · Gem::SafeMarshal::Visitors::ToRuby::UnpermittedSymbolError

Attempting to load unpermitted symbol #{symbol.inspect} @ #{

Error message

Attempting to load unpermitted symbol #{symbol.inspect} @ #{stack.join(".")}

What it means

Error "Attempting to load unpermitted symbol #{symbol.inspect} @ #{stack.join(".")}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/safe_marshal/visitors/to_ruby.rb:59

        array = register_object([])

        elements = a.elements
        size = elements.size
        idx = 0
        # not idiomatic, but there's a huge number of IMEMOs allocated here, so we avoid the block
        # because this is such a hot path when doing a bundle install with the full index
        while idx < size
          push_stack idx
          array << visit(elements[idx])
          idx += 1
        end

        array
      end

      def visit_Gem_SafeMarshal_Elements_Symbol(s)
        name = s.name
        raise UnpermittedSymbolError.new(symbol: name, stack: formatted_stack) unless @permitted_symbols.include?(name)
        visit_symbol_type(s)
      end

      def map_ivars(klass, ivars)
        stack_idx = @stack_idx
        ivars.map.with_index do |(k, v), i|
          @stack_idx = stack_idx

          push_stack "ivar_"
          push_stack i
          k = resolve_ivar(klass, k)

          @stack_idx = stack_idx
          push_stack k

          next k, visit(v)
        end
      end

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Do not install the gem: its metadata references a symbol outside the permitted set
  2. Fetch the gem from the official source; report the tampered package if it persists

When it happens

Trigger: Thrown at lib/rubygems/safe_marshal/visitors/to_ruby.rb:59 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23). Data as JSON: /api/errors/c6e1ca5e68ca63a2. Report an issue: GitHub.