Solargraph: undefined method `children' for :private_class_method:Symbol

Created on 27 Apr 2020  路  10Comments  路  Source: castwide/solargraph

Not sure if error is here or in vscode integration, but only the the gem was updated today so guessing it's here.

[Error - 8:59:43 AM] Server initialization failed. Message: [NoMethodError] undefined method `children' for :private_class_method:Symbol Code: -32603

vscode
Version: 1.44.2
Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
Date: 2020-04-16T17:07:18.473Z (1 wk ago)
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.4.0

Most helpful comment

Fixed in gem v0.39.3.

All 10 comments

Is there a backtrace in the debug console?

Yes:

[2020-04-27 08:59:44.239] [renderer1] [error] [NoMethodError] undefined method `children' for :private_class_method:Symbol: Error: [NoMethodError] undefined method `children' for :private_class_method:Symbol at new ResponseError (/Users/anders/.vscode/extensions/castwide.solargraph-0.21.1/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/messages.js:46:28) at handleResponse (/Users/anders/.vscode/extensions/castwide.solargraph-0.21.1/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/main.js:430:48) at processMessageQueue (/Users/anders/.vscode/extensions/castwide.solargraph-0.21.1/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/main.js:258:17) at Immediate.<anonymous> (/Users/anders/.vscode/extensions/castwide.solargraph-0.21.1/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/main.js:242:13) at processImmediate (internal/timers.js:439:21)

Thanks for tracking that down, but is there another one by chance? That one came from the extension, and I'm hoping there's another one that came directly from the language server. I have a general idea of what the root cause might be, but the language server's backtrace could save me some process of elimination.

Edit: Also, just to clarify, the backtrace I'm looking for would be in the developer console (Help -> Toggle Developer Tools).

This is the smallest reproducible example I could find:

class Foo
  private_class_method
end

Calling private_class_method without arguments is technically valid but has no effect. I've committed a change that gracefully handles it and will include the fix in the next patch release.

[WARN] /Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/rubyvm/node_processors/send_node.rb:273:in `process_private_class_method`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/rubyvm/node_processors/send_node.rb:35:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor.rb:38:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:46:in `block in process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:36:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor.rb:38:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:46:in `block in process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/rubyvm/node_processors/scope_node.rb:9:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor.rb:38:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:46:in `block in process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/rubyvm/node_processors/namespace_node.rb:33:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor.rb:38:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:46:in `block in process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:36:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor.rb:38:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:46:in `block in process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/rubyvm/node_processors/scope_node.rb:9:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor.rb:38:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:46:in `block in process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/rubyvm/node_processors/namespace_node.rb:33:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor.rb:38:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:46:in `block in process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:44:in `process_children`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor/base.rb:36:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/node_processor.rb:38:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/parser/rubyvm/class_methods.rb:29:in `map`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/source_map/mapper.rb:26:in `map`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/source_map/mapper.rb:50:in `map`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/source_map.rb:141:in `map`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/api_map.rb:88:in `block in catalog`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/api_map.rb:70:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/api_map.rb:70:in `catalog`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/library.rb:23:in `initialize`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/library.rb:363:in `new`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/library.rb:363:in `load`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/host.rb:278:in `prepare`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/host.rb:295:in `block in prepare_folders`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/host.rb:294:in `each`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/host.rb:294:in `prepare_folders`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/message/initialize.rb:14:in `block in process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/benchmark-0.1.0/lib/benchmark.rb:293:in `measure`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/message/initialize.rb:10:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/host.rb:101:in `receive`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/transport/adapter.rb:44:in `process`
/Users/anders/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/solargraph-0.39.2/lib/solargraph/language_server/transport/adapt

Hi,

Same issue here. I updated the gem 2 days ago and the language server is not starting anymore.

I am using neovim with coc.nvim to manage my extensions.

## Messages[coc.nvim] [NoMethodError] undefined method `children' for :private_class_method:Symbol
[coc.nvim] Solargraph failed to initialize.
[coc.nvim] Failed to start Solargraph: Error: [NoMethodError] undefined method `children' for :private_class_method:Symbol

Fixed in gem v0.39.3.

I updated to 0.39.7 and I get the same error as hourliert

What version of Ruby are you using?

Can you confirm that your client is running the version of Solargraph you expect? There are some cases, especially with version managers like rvm, where the client doesn't run in the same environment as a terminal. In VS Code, you can confirm by running "Solargraph: Get environment info" from the command palette.

I was loading the wrong version. I'm using rbenv and you are correct about your suspicions that's loading the wrong gem. Thank you for your prompt response! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tylerlu94 picture tylerlu94  路  5Comments

castwide picture castwide  路  3Comments

taylorthurlow picture taylorthurlow  路  4Comments

Shougo picture Shougo  路  4Comments

gencer picture gencer  路  3Comments