I’m not sure about the specific technical reasons in this case, since “plain” Numpy does accept it.
But the exception shows that you’re trying to modify the uint8 array, in-place, using an int64 scalar.
I’ve had similar cases where in-place modification works best when you ensure you cast the value explicitly to the same datatype.
In this case you can make your mask value also a uint8 in order to make it work.
f(a, 3, 2, numba.uint8(8))
I’m not sure if that’s an unambiguous solution that Numba also could do itself in the background, or that making such an assumption has some side effects, and therefore it needs to be up to the user.