ELixir LS error: (UndefinedFunctionError) function SSLVerifyFun.Mixfile.project/0 is undefined (module SSLVerifyFun.Mixfile is not available)

an exception was raised:

    ** (UndefinedFunctionError) function SSLVerifyFun.Mixfile.project/0 is undefined (module SSLVerifyFun.Mixfile is not available)
        SSLVerifyFun.Mixfile.project()
        (mix 1.14.1) lib/mix/project.ex:838: Mix.Project.get_project_config/1
        (mix 1.14.1) lib/mix/project.ex:141: Mix.Project.push/3
        (mix 1.14.1) lib/mix/project.ex:785: Mix.Project.load_project/2
        (mix 1.14.1) lib/mix/project.ex:389: Mix.Project.in_project/4
        (elixir 1.14.1) lib/file.ex:1607: File.cd!/2
        (language_server 0.14.6) lib/language_server/build.ex:83: anonymous fn/3 in ElixirLS.LanguageServer.Build.reload_project/0
        (stdlib 4.2) maps.erl:411: :maps.fold_1/3
1 Like

Have you tried the standard diagnostic steps (remove _build, remove .elixir_ls, restart all the things) yet?

If you try those and this keeps happening, you’ll need to provide more information about what’s triggering this behavior - what’s in your project’s mix.exs?

I’ve got an identical error trace with a different library at the end of it:

** (UndefinedFunctionError) function OpentelemetryLoggerMetadata.MixProject.project/0 is undefined (module OpentelemetryLoggerMetadata.MixProject is not available)
        OpentelemetryLoggerMetadata.MixProject.project()
        (mix 1.14.3) lib/mix/project.ex:838: Mix.Project.get_project_config/1
        (mix 1.14.3) lib/mix/project.ex:141: Mix.Project.push/3
        (mix 1.14.3) lib/mix/project.ex:785: Mix.Project.load_project/2
        (mix 1.14.3) lib/mix/project.ex:389: Mix.Project.in_project/4
        (elixir 1.14.3) lib/file.ex:1607: File.cd!/2
        (language_server 0.14.6) lib/language_server/build.ex:83: anonymous fn/3 in ElixirLS.LanguageServer.Build.reload_project/0
        (stdlib 4.2) maps.erl:411: :maps.fold_1/3

The thing is that OpentelemetryLoggerMetadata.MixProject.project/0 absolutely does exist. Both on github (linked) and also in my deps file.

I’ve recently deleted both _build and my .elixir_ls directories.

Edit: I should say that this is only a problem for the language server - my project builds fine and passes all tests. This is some internal language server process - apparently in the reload_project/0 function.

1 Like

Please share a repo that reproduces this problem

If I find one I will do so! I can’t share the repo I am working on (its proprietary code) and the problem is transitive - it resolved itself after…“a while”? I made no effort to fix it, the language server just stopped complaining.

1 Like
an exception was raised:
    ** (UndefinedFunctionError) function Tzdata.Mixfile.project/0 is undefined (module Tzdata.Mixfile is not available)
        Tzdata.Mixfile.project()
        (mix 1.14.1) lib/mix/project.ex:838: Mix.Project.get_project_config/1
        (mix 1.14.1) lib/mix/project.ex:141: Mix.Project.push/3
        (mix 1.14.1) lib/mix/project.ex:785: Mix.Project.load_project/2
        (mix 1.14.1) lib/mix/project.ex:389: Mix.Project.in_project/4
        (elixir 1.14.1) lib/file.ex:1607: File.cd!/2
        (language_server 0.15.1) lib/language_server/build.ex:83: anonymous fn/3 in ElixirLS.LanguageServer.Build.reload_project/0
        (stdlib 4.2) maps.erl:411: :maps.fold_1/3

an exception was raised:
** (UndefinedFunctionError) function Tzdata.Mixfile.project/0 is undefined (module Tzdata.Mixfile is not available)
Tzdata.Mixfile.project()
(mix 1.14.1) lib/mix/project.ex:838: Mix.Project.get_project_config/1
(mix 1.14.1) lib/mix/project.ex:141: Mix.Project.push/3
(mix 1.14.1) lib/mix/project.ex:785: Mix.Project.load_project/2
(mix 1.14.1) lib/mix/project.ex:389: Mix.Project.in_project/4
(elixir 1.14.1) lib/file.ex:1607: File.cd!/2
(language_server 0.15.1) lib/language_server/build.ex:83: anonymous fn/3 in ElixirLS.LanguageServer.Build.reload_project/0
(stdlib 4.2) maps.erl:411: :maps.fold_1/3ElixirLS

Kernel.defmodule(alias, do_block) view on hexdocs

Defines a module given by name with the given contents.

This macro defines a module with the given alias as its name and with the given contents. It returns a tuple with four elements:

  • :module
  • the module name
  • the binary contents of the module
  • the result of evaluating the contents block

Examples

defmodule KCCore.Umbrella.MixProject do


  use Mix.Project

  def project,
    do: [
      apps_path: "apps",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      releases: releases(),
      aliases: aliases(),
      dialyzer: [
        plt_core_path: "priv/plts",
        plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
        plt_add_deps: :app_tree,
        plt_add_apps: [:mix, :ex_unit],
        flags: [:error_handling, :underspecs]
      ],
      test_coverage: [tool: ExCoveralls],
      preferred_cli_env: [
        coveralls: :test,
        "coveralls.detail": :test,
        "coveralls.post": :test,
        "coveralls.html": :test
      ]
    ]

  def aliases() do
    [
      "ecto.setup": ["ecto.create", "ecto.migrate"],
      "ecto.reset": ["ecto.drop", "ecto.setup"],
      test: ["ecto.setup", "test"],
      "dev.update_deps": [
        "hex.outdated --within-requirements",
        "deps.update --all --only",
        "deps.clean --all --only",
        "deps.get",
        "deps.compile",
        "hex.outdated --within-requirements"
      ],
      "dev.checks": [
        "clean",
        "format",
        "compile",
        " hex.outdated --within-requirements",
        "credo",
        "sobelow",
        "cmd mix test --trace",
        "dialyzer"
      ]
    ]
  end

  defp deps(),
    do: [
      {:dialyxir, "~> 1.3", only: [:dev, :test], runtime: false},
      {:excoveralls, "~>  0.16.1", only: :test, runtime: false},
      {:ex_doc, "~>  0.29.4", only: :dev, runtime: false},
      {:credo, "~> 1.7", only: [:dev, :test], runtime: false},
      {:sobelow, "~> 0.12.2", only: [:dev, :test], runtime: false},
      # Override because there is a version conflict with AppStack
      {:hackney, "~> 1.18.1"}
    ]

  defp releases(),
    do: [
      kc_release: [
        version: "0.0.1",
        applications: [
          proxy: :permanent,
          kc_core: :permanent,
          kc_web: :permanent,
          admin: :permanent
        ],
        include_executables_for: [:unix]
      ]
    ]

  def application,
    do: [
      extra_applications: [
        :logger,
        :ssl,
        :runtime_tools
      ]
    ]
end
an exception was raised:
** (UndefinedFunctionError) function Proxy.Mixfile.project/0 is undefined (module Proxy.Mixfile is not available)
Proxy.Mixfile.project()
(mix 1.14.1) lib/mix/project.ex:838: Mix.Project.get_project_config/1
(mix 1.14.1) lib/mix/project.ex:141: Mix.Project.push/3
(mix 1.14.1) lib/mix/project.ex:785: Mix.Project.load_project/2
(mix 1.14.1) lib/mix/project.ex:389: Mix.Project.in_project/4
(elixir 1.14.1) lib/file.ex:1607: File.cd!/2
(language_server 0.15.1) lib/language_server/build.ex:83: anonymous fn/3 in ElixirLS.LanguageServer.Build.reload_project/0
(stdlib 4.2) maps.erl:411: :maps.fold_1/3ElixirLS

> Kernel.defmodule(alias, do_block) [view on hexdocs](vscode-file://vscode-app/usr/share/code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)