Skip to main content

L1207 - Attribute after function definition

Error

    -module(my_module).
-export([foo/0]).
foo() -> ok.
-my_attribute(some_value).
%% ^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: attrubute my_attribute after function definition

Explanation

Erlang attributes must be defined before any function definition.

To fix this error, move the attribute before the function definition.

    -module(my_module).
-export([foo/0]).
% Correct attribute usage
-my_attribute(some_value).
foo() -> ok.