Cause
You design with plugs and manage female and male pins separately. The function definitions of two corresponding plug definitions with the same DT do not match. The pair relationship between plug and socket is not defined by this.
Solution
Check that the correct function definition is set in the plug definition for the female and male sides. To do this, call up the Properties <...> dialog and, in the Plug definition tab, examine the settings in the Function definition field.
For the plug definition on the female side, the function definition must be set to "Plug definition for female pins". For the plug definition on the male side, the function definition must be set to "Plug definition for male pins".
Change the incorrect settings according to these instructions and then begin a new project check.