Skip to main content

W0089: Undefined Module

Error​

-module(main).
main(F) ->
undefined_mod:F().
%%^^^^^^^^^^^^^ warning: W0089: Module 'undefined_mod' is undefined.

Explanation​

This diagnostic warns you when a call names a module which cannot be found, but not the function it calls. It covers:

  • Remote calls and function references whose function name is not an atom, such as undefined_mod:F() or fun undefined_mod:F/1
  • Dynamic calls that call a function of the given module with a list of arguments, such as apply(undefined_mod, F, Args) or rpc:call(Node, undefined_mod, F, Args). These are the dynamic call patterns with Module, Function and Args arguments, built in or configured in the dynamic_calls section of .elp_lint.toml

Calls that name both the module and the function, such as undefined_mod:f(), are reported by W0017 instead. Calls whose module is not an atom, such as Mod:F(), are not checked.

Calls to a module that the same file creates with meck:new(Module, Options) are not reported when Options is a list, written out in the call, that contains non_strict.

The problem could be due to a misspelling of the module name, to a recent removal of the module, or to a misconfiguration of the language server.

How to Fix​

  • Fix the module name
  • Or make the module part of the project