Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while indexing: undefined method `file_path' for nil:NilClass #2295

Closed
mjohansenwork opened this issue Jul 12, 2024 · 10 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@mjohansenwork
Copy link

Description

I keep randomly seeing this error message pop up:
image

Error while indexing: undefined method `file_path' for nil:NilClass

I don't see anything listed in the Ruby LSP VSCode extension output related to the error message.

VSCode Version: 1.91.1 (Universal)
Ruby LSP extension v0.7.11

@mjohansenwork mjohansenwork added the bug Something isn't working label Jul 12, 2024
@rdsngit
Copy link

rdsngit commented Jul 12, 2024

I'm also seeing this show up after launching VS code from the terminal using code .

It looks like it occurs during ruby-lsp indexing and reaches around half way before showing the Ruby LSP error:

Error while indexing: undefined method Error while indexing: undefined method `file_path' for nil

Screenshot 2024-07-12 at 10 23 10

Screenshot 2024-07-12 at 10 19 35

Ruby-LSP v0.7.11 VS Code extension: https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp

Version: 1.91.1
Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
Date: 2024-07-09T22:07:46.768Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

@andyw8
Copy link
Contributor

andyw8 commented Jul 12, 2024

Hi, can you please run ruby-lsp-doctor on the command line. That should indicate which file is to blame, and then we can try narrow down the problematic code.

@vinistock
Copy link
Member

This is the same issue as #2287. Let's please centralize the discussions in one place.

@vinistock vinistock closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
@mjohansenwork
Copy link
Author

@andyw8 I ran ruby-lsp-doctor and there was a lot of output that said indexing: ...somefile. It ran without any errors, though.

@andyw8
Copy link
Contributor

andyw8 commented Jul 15, 2024

Note: The ruby-lsp-doctor command is now ruby-lsp --doctor (#2310)

@rdsngit
Copy link

rdsngit commented Jul 16, 2024

@andyw8 I ran your suggestion using bundler exec ruby-lsp-doctor in a project using Ruby v3.3.1.

      raise TypeError.new("Passed `nil` into T.must")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	from /Users/[USERNAME]/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.7/lib/ruby_indexer/lib/ruby_indexer/index.rb:526:in `existing_or_new_singleton_class'

It turned out that the indexing was failing due to an older version of database_cleaner and upgrading it to version 2.0.2 resulted in the indexing completion without errors.

Thank you for your advice to help resolve this.

I see you have created #2296, and that seems a good idea to support users diagnose their local causes of indexing errors.

@andyw8
Copy link
Contributor

andyw8 commented Jul 16, 2024

Thank @rdsngit, could you tell me what the old version of database_cleaner was, so that we can verify that #2287 fixes it?

@rdsngit
Copy link

rdsngit commented Jul 16, 2024

Thank @rdsngit, could you tell me what the old version of database_cleaner was, so that we can verify that #2287 fixes it?

@andyw8 Yes, it was Ruby v3.3.1 and database_cleaner v1.7.0 that resulted in the error using bundle exec ruby-lsp-doctor.

After upgrading database_cleaner to v2.0.2 and opening VS Code the ruby-lsp VS Code extension showed the indexing completed without any errors.

@andyw8
Copy link
Contributor

andyw8 commented Jul 16, 2024

Thanks, I verified that database_cleaner v1.7.0 can be successfully indexed now.

@rdsngit
Copy link

rdsngit commented Jul 16, 2024

Thanks, I verified that database_cleaner v1.7.0 can be successfully indexed now.

Brilliant, good to hear you have verified that was the fix for the indexing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants