Skip to content

no implicit conversion of nil into String #718

@bubbaspaarx

Description

@bubbaspaarx

I had an error running on our local build and it would give the error when running the rails console

/Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/watcher/abstract.rb:42:in `initialize': no implicit conversion of nil into String (TypeError)
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/watcher/abstract.rb:42:in `new'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/watcher/abstract.rb:42:in `block in add'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/watcher/abstract.rb:41:in `map'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/watcher/abstract.rb:41:in `add'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/application.rb:114:in `rescue in preload'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/application.rb:112:in `preload'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/application.rb:166:in `serve'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/application.rb:148:in `block in run'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/application.rb:142:in `loop'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/application.rb:142:in `run'
from /Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/spring-4.1.3/lib/spring/application/boot.rb:19:in `<top (required)>'
from <internal:/Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/Users/jim.bob/.rbenv/versions/3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from -e:1:in `<main>'

After a lot of investigating, it was an error in our code. The line of code seems to bear no relevance to the error.

code

redo if @counter <= 5

which actually causes the error

(eval):2: Can't escape from eval with redo

This took some significant time to debug as the error message was seemingly unrelated to the bad code.
Is there a reason why the error message wasn't explicit about the issue and it's location?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions