Skip to main content

W0059: Unavailable Type

Error

-module(main).
-spec foo() -> dep:nonexistent_type().
%% ^^^^^^^^^^^^^^^^^^^^^^ warning: W0059: Type 'dep:nonexistent_type/0' is not available through dependencies.
foo() -> ok.

Explanation

This diagnostic warns you when your code references a type that either:

  1. Does not exist (is undefined)
  2. Is not accessible because it's from a module outside your application's dependencies
  3. Exists but is not exported from the defining module

What This Diagnostic Checks

The diagnostic examines:

  • Type specifications (-spec attributes)
  • Type definitions (-type and -opaque attributes)
  • Callback specifications (-callback attributes)

How to Fix

  • Check if the type actually exists
  • Verify the name and arity of the type
  • Add the application that defines the type to your application's dependencies or move the type definition to an application that is already a dependency