question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Elixir LSP Fails to Start

See original GitHub issue

I’m seeing the following error using the latest version of coc-elixir:

12:28:30.454 [error] GenServer ElixirLS.LanguageServer.Server terminating
** (Mix.Error) Unknown dependency :ecto given to :import_deps in the formatter configuration. The dependency is not listed in your mix.exs for environment :prod
    (mix 1.10.4) lib/mix.ex:392: Mix.raise/1
    (mix 1.10.4) lib/mix/tasks/format.ex:246: anonymous fn/3 in Mix.Tasks.Format.eval_deps_opts/2
    (elixir 1.10.4) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
    (mix 1.10.4) lib/mix/tasks/format.ex:245: Mix.Tasks.Format.eval_deps_opts/2
    (mix 1.10.4) lib/mix/tasks/format.ex:201: anonymous fn/5 in Mix.Tasks.Format.eval_deps_and_subdirectories/4
    (mix 1.10.4) lib/mix/tasks/format.ex:210: Mix.Tasks.Format.maybe_cache_in_manifest/3
    (mix 1.10.4) lib/mix/tasks/format.ex:160: Mix.Tasks.Format.formatter_opts_for_file/2
    (language_server 0.5.0) lib/language_server/server.ex:487: ElixirLS.LanguageServer.Server.handle_request/2
Last message: {:"$gen_cast", {:receive_packet, %{"id" => 132, "jsonrpc" => "2.0", "method" => "textDocument/completion", "params" => %{"context" => %{"triggerKind" => 3}, "position" => %{"character" => 11, "line" => 183}, "textDocument" => %{"uri" => "file:///Users/james/Projects/rovr_api/test/rovr_api_web/controllers/read_receipt_controller_test.exs"}}}}}
State: %ElixirLS.LanguageServer.Server{analysis_ready?: false, awaiting_contracts: [], build_diagnostics: [], build_ref: #Reference<0.1375640648.712245250.125063>, build_running?: true, client_capabilities: %{"textDocument" => %{"codeAction" => %{"codeActionLiteralSupport" => %{"codeActionKind" => %{"valueSet" => ["", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports"]}}, "dynamicRegistration" => true, "isPreferredSupport" => true}, "codeLens" => %{"dynamicRegistration" => true}, "colorProvider" => %{"dynamicRegistration" => true}, "completion" => %{"completionItem" => %{"commitCharactersSupport" => true, "deprecatedSupport" => true, "documentationFormat" => ["markdown", "plaintext"], "preselectSupport" => true, "snippetSupport" => true}, "completionItemKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}, "contextSupport" => true, "dynamicRegistration" => true}, "declaration" => %{"dynamicRegistration" => true}, "definition" => %{"dynamicRegistration" => true}, "documentHighlight" => %{"dynamicRegistration" => true}, "documentLink" => %{"dynamicRegistration" => true, "tooltipSupport" => true}, "documentSymbol" => %{"dynamicRegistration" => true, "hierarchicalDocumentSymbolSupport" => true, "symbolKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}, "tagSupport" => %{"valueSet" => [1]}}, "foldingRange" => %{"dynamicRegistration" => true, "lineFoldingOnly" => true, "rangeLimit" => 5000}, "formatting" => %{"dynamicRegistration" => true}, "hover" => %{"contentFormat" => ["markdown", "plaintext"], "dynamicRegistration" => true}, "implementation" => %{"dynamicRegistration" => true}, "onTypeFormatting" => %{"dynamicRegistration" => true}, "publishDiagnostics" => %{"relatedInformation" => true, "tagSupport" => %{"valueSet" => [1, 2]}, "versionSupport" => false}, "rangeFormatting" => %{"dynamicRegistration" => true}, "references" => %{"dynamicRegistration" => true}, "rename" => %{"dynamicRegistration" => true, "prepareSupport" => true}, "selectionRange" => %{"dynamicRegistration" => true}, "signatureHelp" => %{"dynamicRegistration" => true, "signatureInformation" => %{"documentationFormat" => ["markdown", "plaintext"], "parameterInformation" => %{"labelOffsetSupport" => true}}}, "synchronization" => %{"didSave" => true, "dynamicRegistration" => true, "willSave" => true, "willSaveWaitUntil" => true}, "typeDefinition" => %{"dynamicRegistration" => true}}, "window" => %{"workDoneProgress" => true}, "workspace" => %{"applyEdit" => true, "configuration" => true, "didChangeConfiguration" => %{"dynamicRegistration" => true}, "didChangeWatchedFiles" => %{"dynamicRegistration" => true}, "executeCommand" => %{"dynamicRegistration" => true}, "symbol" => %{"dynamicRegistration" => true, "symbolKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}, "tagSupport" => %{"valueSet" => [1]}}, "workspaceEdit" => %{"documentChanges" => true, "failureHandling" => "textOnlyTransactional", "resourceOperations" => ["create", "rename", "delete"]}, "workspaceFolders" => true}}, dialyzer_diagnostics: [], dialyzer_sup: #PID<0.124.0>, load_all_modules?: false, needs_build?: false, project_dir: "/Users/james/Projects/rovr_api", received_shutdown?: false, requests: %{}, root_uri: "file:///Users/james/Projects/rovr_api", server_instance_id: "OVfDHNaNPl1v2L2pm7StSX_IPTWne1P2", settings: %{"dialyzerEnabled" => true, "dialyzerFormat" => "dialyzer", "dialyzerWarnOpts" => [], "fetchDeps" => true, "mixEnv" => "test", "suggestSpecs" => true}, source_files: %{"file:///Users/james/Projects/rovr_api/lib/rovr_api/accounts/user.ex" => %ElixirLS.LanguageServer.SourceFile{dirty?: false, text: "defmodule RovrApi.Accounts.User do\n  @moduledoc \"\"\"\n  User data\n  \"\"\"\n\n  use Ecto.Schema\n  import Ecto.Changeset\n\n  alias RovrApi.Subscriptions.Subscription\n\n  @type t :: %__MODULE__{\n          id: String.t() | nil,\n          email: String.t() | nil,\n          confirmed_at: NaiveDateTime.t() | nil,\n          hashed_password: String.t() | nil,\n          inserted_at: NaiveDateTime.t() | nil,\n          updated_at: NaiveDateTime.t() | nil\n        }\n\n  @derive {Inspect, except: [:password]}\n  @primary_key {:id, :binary_id, autogenerate: true}\n  @foreign_key_type :binary_id\n  schema \"users\" do\n    field :email, :string\n    field :password, :string, virtual: true\n    field :hashed_password, :string\n    field :confirmed_at, :naive_datetime\n\n    has_many :subscriptions, Subscription\n\n    has_many :feeds, through: [:subscriptions, :feeds]\n\n    timestamps()\n  end\n\n  @doc \"\"\"\n  A user changeset for registration.\n\n  It is important to validate the length of both e-mail and password.\n  Otherwise databases may truncate the e-mail without warnings, which\n  could lead to unpredictable or insecure behaviour. Long passwords may\n  also be very expensive to hash for certain algorithms.\n  \"\"\"\n  @spec registration_changeset(t(), map()) :: Ecto.Changeset.t()\n  def registration_changeset(%__MODULE__{} = user, attrs) do\n    user\n    |> cast(attrs, [:email, :password])\n    |> validate_email()\n    |> validate_password()\n  end\n\n  defp validate_email(changeset) do\n    changeset\n    |> validate_required([:email])\n    |> validate_format(:email, ~r/^[^\\s]+@[^\\s]+$/, message: \"must have the @ sign and no spaces\")\n    |> validate_length(:email, max: 160)\n    |> unsafe_validate_unique(:email, RovrApi.Repo)\n    |> unique_constraint(:email)\n  end\n\n  defp validate_password(changeset) do\n    changeset\n    |> validate_required([:password])\n    |> validate_length(:password, min: 12, max: 80)\n    # |> validate_format(:password, ~r/[a-z]/, message: \"at least one lower case character\")\n    # |> validate_format(:password, ~r/[A-Z]/, message: \"at least one upper case character\")\n    # |> validate_format(:password, ~r/[!?@#$%^&*_0-9]/, message: \"at least one digit or punctuation character\")\n    |> prepare_changes(&hash_password/1)\n  end\n\n  defp hash_password(changeset) do\n    password = get_change(changeset, :password)\n\n    changeset\n    |> put_change(:hashed_password, Bcrypt.hash_pwd_salt(password))\n    |> delete_change(:password)\n  end\n\n  @doc \"\"\"\n  A user changeset for changing the e-mail.\n\n  It requires the e-mail to change otherwise an error is added.\n  \"\"\"\n  @spec email_changeset(t(), map()) :: Ecto.Changeset.t()\n  def email_changeset(%__MODULE__{} = user, attrs) do\n    user\n    |> cast(attrs, [:email])\n    |> validate_email()\n    |> case do\n      %{changes: %{email: _}} = changeset -> changeset\n      %{} = changeset -> (truncated)
[Warn  - 12:28:30 p.m.] ** (exit) exited in: GenServer.call(ElixirLS.LanguageServer.JsonRpc, {:packet, %{"jsonrpc" => "2.0", "method" => "textDocument/didChange", "params" => %{"contentChanges" => [%{"range" => %{"end" => %{"character" => 11, "line" => 183}, "start" => %{"character" => 11, "line" => 183}}, "rangeLength" => 0, "text" => "t"}], "textDocument" => %{"uri" => "file:///Users/james/Projects/rovr_api/test/rovr_api_web/controllers/read_receipt_controller_test.exs", "version" => 308}}}}, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir 1.10.4) lib/gen_server.ex:1013: GenServer.call/3
    (elixir 1.10.4) lib/stream.ex:441: anonymous fn/4 in Stream.each/2
    (elixir 1.10.4) lib/stream.ex:1449: Stream.do_element_resource/6
    (elixir 1.10.4) lib/stream.ex:1609: Enumerable.Stream.do_each/4
    (elixir 1.10.4) lib/stream.ex:649: Stream.run/1
    (stdlib 3.13) erl_eval.erl:680: :erl_eval.do_apply/6
[Error  - 12:28:33 p.m.] /Users/james/dotfiles/config/coc/extensions/node_modules/coc-elixir/els-release/language_server.sh exited with code: 1
[Info  - 12:28:33 p.m.] Connection to server got closed. Server will restart.
[Error  - 12:28:33 p.m.] Request textDocument/completion failed.
Error: Connection got disposed.
    at Object.dispose (/Users/james/.vim/plugged/coc.nvim/build/index.js:17340:25)
    at Object.dispose (/Users/james/.vim/plugged/coc.nvim/build/index.js:58035:35)
    at LanguageClient.handleConnectionClosed (/Users/james/.vim/plugged/coc.nvim/build/index.js:60344:42)
    at LanguageClient.handleConnectionClosed (/Users/james/.vim/plugged/coc.nvim/build/index.js:57647:15)
    at closeHandler (/Users/james/.vim/plugged/coc.nvim/build/index.js:60330:18)
    at CallbackList.invoke (/Users/james/.vim/plugged/coc.nvim/build/index.js:17980:39)
    at Emitter.fire (/Users/james/.vim/plugged/coc.nvim/build/index.js:18039:36)
    at closeHandler (/Users/james/.vim/plugged/coc.nvim/build/index.js:16676:26)
    at CallbackList.invoke (/Users/james/.vim/plugged/coc.nvim/build/index.js:17980:39)
    at Emitter.fire (/Users/james/.vim/plugged/coc.nvim/build/index.js:18039:36)
[Error  - 12:28:33 p.m.] Request textDocument/completion failed.
Error: Connection got disposed.
    at Object.dispose (/Users/james/.vim/plugged/coc.nvim/build/index.js:17340:25)
    at Object.dispose (/Users/james/.vim/plugged/coc.nvim/build/index.js:58035:35)
    at LanguageClient.handleConnectionClosed (/Users/james/.vim/plugged/coc.nvim/build/index.js:60344:42)
    at LanguageClient.handleConnectionClosed (/Users/james/.vim/plugged/coc.nvim/build/index.js:57647:15)
    at closeHandler (/Users/james/.vim/plugged/coc.nvim/build/index.js:60330:18)
    at CallbackList.invoke (/Users/james/.vim/plugged/coc.nvim/build/index.js:17980:39)
    at Emitter.fire (/Users/james/.vim/plugged/coc.nvim/build/index.js:18039:36)
    at closeHandler (/Users/james/.vim/plugged/coc.nvim/build/index.js:16676:26)
    at CallbackList.invoke (/Users/james/.vim/plugged/coc.nvim/build/index.js:17980:39)
    at Emitter.fire (/Users/james/.vim/plugged/coc.nvim/build/index.js:18039:36)
[Error  - 12:28:33 p.m.] Request textDocument/completion failed.
Error: Connection got disposed.
    at Object.dispose (/Users/james/.vim/plugged/coc.nvim/build/index.js:17340:25)
    at Object.dispose (/Users/james/.vim/plugged/coc.nvim/build/index.js:58035:35)
    at LanguageClient.handleConnectionClosed (/Users/james/.vim/plugged/coc.nvim/build/index.js:60344:42)
    at LanguageClient.handleConnectionClosed (/Users/james/.vim/plugged/coc.nvim/build/index.js:57647:15)
    at closeHandler (/Users/james/.vim/plugged/coc.nvim/build/index.js:60330:18)
    at CallbackList.invoke (/Users/james/.vim/plugged/coc.nvim/build/index.js:17980:39)
    at Emitter.fire (/Users/james/.vim/plugged/coc.nvim/build/index.js:18039:36)
    at closeHandler (/Users/james/.vim/plugged/coc.nvim/build/index.js:16676:26)
    at CallbackList.invoke (/Users/james/.vim/plugged/coc.nvim/build/index.js:17980:39)
    at Emitter.fire (/Users/james/.vim/plugged/coc.nvim/build/index.js:18039:36)
Started ElixirLS v0.5.0
Elixir version: "1.10.4 (compiled with Erlang/OTP 23)"
Erlang version: "23"
ElixirLS compiled with Elixir 1.10.3 and erlang 23
MIX_ENV: test
MIX_TARGET: host
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  bcrypt_elixir 2.2.0
  bodyguard 2.4.0
  bunt 0.2.0
  castore 0.1.6
  certifi 2.5.1
  combine 0.10.0
  comeonin 5.3.1
  connection 1.0.4
  cors_plug 2.0.2
  cowboy 2.8.0
  cowlib 2.9.1
  credo 1.4.0
  db_connection 2.2.2
  decimal 1.8.1
  dialyxir 1.0.0
  ecto 3.4.4
  ecto_sql 3.4.4
  elixir_make 0.6.0
  erlex 0.2.6
  feeder 2.3.2
  feeder_ex 1.1.0
  floki 0.26.0
  gettext 0.18.0
  hackney 1.15.2
  html_entities 0.5.1
  idna 6.0.0
  jason 1.2.1
  jsonapi 1.3.0
  metrics 1.0.1
  mime 1.3.1
  mimerl 1.2.0
  mint 1.1.0
  oban 2.0.0-rc.3
  parse_trans 3.3.0
  phoenix 1.5.3
  phoenix_ecto 4.1.0
  phoenix_html 2.14.2
  phoenix_live_dashboard 0.2.6
  phoenix_live_view 0.13.3
  phoenix_pubsub 2.0.0
  phx_gen_auth 0.4.0
  plug 1.10.3
  plug_cowboy 2.3.0
  plug_crypto 1.1.2
  postgrex 0.15.5
  ranch 1.7.1
  sentry 7.2.4
  sobelow 0.10.3
  ssl_verify_fun 1.1.5
  telemetry 0.4.1
  telemetry_metrics 0.5.0
  telemetry_poller 0.5.0
  tesla 1.3.3
  timex 3.6.2
  tzdata 1.0.3
  unicode_util_compat 0.4.1
All dependencies are up to date
==> ecto_sql
Compiling 26 files (.ex)
Generated ecto_sql app
==> oban
Compiling 20 files (.ex)
Generated oban app
==> plug_crypto
Compiling 5 files (.ex)
Generated plug_crypto app
==> plug
Compiling 1 file (.erl)
Compiling 40 files (.ex)
[Warn  - 12:28:45 p.m.] warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
  lib/plug/conn/wrapper_error.ex:23

Generated plug app
==> bodyguard
Compiling 9 files (.ex)
[Warn  - 12:28:49 p.m.] warning: function actions/1 required by protocol Plug.Exception is not implemented (in module Plug.Exception.Bodyguard.NotAuthorizedError)
  lib/bodyguard/not_authorized_error.ex:8: Plug.Exception.Bodyguard.NotAuthorizedError (module)

Generated bodyguard app
==> cors_plug
Compiling 1 file (.ex)
Generated cors_plug app
==> jsonapi
Compiling 21 files (.ex)
Generated jsonapi app
==> plug_cowboy
Compiling 6 files (.ex)
Generated plug_cowboy app
==> phoenix_html
Compiling 8 files (.ex)
Generated phoenix_html app
==> phoenix
Compiling 66 files (.ex)
Generated phoenix app
==> sentry
Compiling 14 files (.ex)
Generated sentry app
==> phoenix_live_view
Compiling 18 files (.ex)
Generated phoenix_live_view app
==> phoenix_live_dashboard
Compiling 33 files (.ex)
Generated phoenix_live_dashboard app
==> phoenix_ecto
Compiling 7 files (.ex)

In a previous session the :ecto dependency was something else entirely.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
heimanncommented, Jul 8, 2020

@heimann i solved it by building from source

here’s the coc-elixir guide but i guess it might work for vscode too https://github.com/elixir-lsp/coc-elixir#troubleshooting

so i’m guessing coc-elixir might need to be built with a newer version of elixir/otp. i would be careful of otp 23 though, as it breaks a few libraries

Worked for me by upgrading to OTP 23 but yes, OTP 23 does break a lot of libs so I had to do some cascading updates across the board (because of deprecating of SSL 3.0 which tbh is a very good idea anyway 😃 ).

1reaction
dylan-chongcommented, Jul 8, 2020

@heimann i solved it by building from source

here’s the coc-elixir guide but i guess it might work for vscode too https://github.com/elixir-lsp/coc-elixir#troubleshooting

so i’m guessing coc-elixir might need to be built with a newer version of elixir/otp. i would be careful of otp 23 though, as it breaks a few libraries

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - ElixirLS
Basic troubleshooting steps: Restart your editor (which will restart ElixirLS); After stopping your editor, remove the entire .elixir_ls directory, then restart ...
Read more >
Failed to run 'elixir' command error in vs code - Questions / Help
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run...
Read more >
VS Code Broken for Elixir
How did you launch the VS Code editor? If asdf is correctly configured in a terminal and you are only opening the Elixir...
Read more >
Language Servers - LSP for Sublime Text
Open Preferences > Package Settings > LSP > Settings and add the "clojure-lsp" client configuration to ... Follow installation instructions on LSP-elixir.
Read more >
Newbie LSP configuration problems : r/neovim - Reddit
Hi, I'm switching from Vim/CoC to Neovim/Native-LSP. For some reason the Lua LSP isn't working. After I open Neovim I receive this message...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found