pry/pry · error · Pry::CommandError

The given backtrace level is out of bounds.

Error message

The given backtrace level is out of bounds.

What it means

Error "The given backtrace level is out of bounds." thrown in pry/pry.

Source

Thrown at lib/pry/commands/cat/exception_formatter.rb:68

        end

        def increment_backtrace_level
          ex.inc_bt_index
        end

        def backtrace_file
          Array(ex.bt_source_location_for(backtrace_level)).first
        end

        def backtrace_line
          Array(ex.bt_source_location_for(backtrace_level)).last
        end

        def check_for_errors
          raise CommandError, "No exception found." unless ex
          return if backtrace_file

          raise CommandError, "The given backtrace level is out of bounds."
        end

        def start_and_end_line_for_code_window
          start_line = backtrace_line - code_window_size
          start_line = 1 if start_line < 1

          [start_line, backtrace_line + code_window_size]
        end

        def header
          unindent(
            "#{bold 'Exception:'} #{ex.class}: #{ex.message}\n" \
            "--\n" \
            "#{bold('From:')} #{backtrace_file}:#{backtrace_line} @ " \
            "#{bold("level: #{backtrace_level}")} of backtrace " \
            "(of #{ex.backtrace.size - 1}).\n\n"
          )
        end

View on GitHub (pinned to 1356402628)

When it happens

Trigger: Thrown at lib/pry/commands/cat/exception_formatter.rb:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pry/pry@1356402628 (2026-08-21). Data as JSON: /api/errors/233cd2309e606995. Report an issue: GitHub.