[erlang-questions] possible dialyzer bug

Kostis Sagonas <>
Mon Jan 25 15:14:59 CET 2016

On 01/25/2016 03:09 PM, Zachary Kessin wrote:
> I have a strange dialyzer problem, I have this code
>                    case convert_map_to_record(MapId, UserId, ClientId,
> Terms) of
>                        {ok, MapRecord} ->
>                            %....
>                            {true, ReqData1, MapRecord};
>                        {error, Error} ->
>                            lager:error("Error ~p", [Error]),
>                            {{error, 405}, ReqData, State}
>                    end
> and dialyzer is saying this
> _build/default/lib/frontend/src/wm_map.erl
>   100: The pattern {'ok', MapRecord} can never match the type {'error',_}
> With what is line 100 being the line with the red background, what is
> strange is that that the error case is covered in the case statement

Yes, what dialyzer tells you is that it has somehow inferred that your 
convert_map_to_record/4 function only returns {'error',_}, so the 
{'ok',_} pattern will never match.

Most likely, your convert_map_to_record/4 function does not do what you 
think it does...  For more info, please submit a complete module that 
illustrates the problem.


More information about the erlang-questions mailing list