Skip to main content

L1253 - Redefine record

Error

    -record(person, {name, age}).
-record(person, {name, age, city}).
%% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: record person already defined

Explanation

This error occurs when you attempt to define a record with the same name more than once in the same module.

Each record name must be unique within a module. If you need to modify a record definition, you should update the original definition rather than creating a new one with the same name.

To fix this error, either:

  1. Remove the duplicate record definition
  2. Rename one of the records to have a different name
  3. Combine the field definitions into a single record definition
%% Correct approach - single record definition
-record(person, {name, age, city}).