The function locked is defined (the exception should also tell you in which while and on what line its definition starts), but none of the clauses matches the parameters shown in the exception.
For example, if we define
nfcm([H|T],X) ->
[H,X|T];
nfcm({A,B},C) ->
{A,C,B}.
We can call nfcm([1,2,3], 4) and nfcm({1,2}, 3) to get [1,4,2,3] and {1,3,2}, but calling nfcm(1, 2) or nfcm({1,2,3}, 4) leads to the exception, as 1 doesn't match neither a list nor a tuple, and {1,2,3} doesn't match a list either, and doesn't match a tuple of two elements.
There are two ways to solve the problem: either fix the definition of the function, or fix the parameters to match the existing definition.