# Stack level too deep (SystemStackError)

**URL:** <https://www.ruby-forum.com/t/stack-level-too-deep-systemstackerror/94599>\
**Category:** Engines\
**Created:** [May 8, 2006, 7:29pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-systemstackerror/94599 "2006-05-08T19:29:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [May 8, 2006, 7:29pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-systemstackerror/94599/1 "2006-05-08T19:29:18Z")

</div>

I picked up a post on the RoR list and decided to see if it fixed my  
stack level problem. It did so Iâ??m x-posting. Here is the original post,  
in case anyone else is having this problem:

For clarification, the problem only occurs in an environment where Gem  
Rails is present. The current code handles this improperly. So, we have  
a stop-gap fix and it appears the real fix is due RSN.

> > ```
> > #load this before doing ANYTHING freaky with the reloading.
> > begin
> > require 'rails_version' # Rails 1.0, 1.1.0
> > rescue LoadError, Gem::Exception
> > require 'rails/version' # renamed as of Rails 1.1.1
> > end
> > 
> > ```
> > 
> > As I am running Rails 1.1.2, in order to get the correct rails version  
> > file being loaded I need the first “require” above to fail, so that the  
> > rescue kicks in and the second “require” loads the “rails/version.rb”  
> > from vendor/rails/…
> > 
> > Unfortunately, in my case (on Dreamhost) the first require does not fail  
> > as the Rails 1.0 gem is available.
> > 
> > If I change the above code to simply say:
> > 
> > require ‘rails/version’
> > 
> > then my app works just fine.
