Hey Dan,
Yes, the $layer originates from a feature service layer in a web map (it is a hosted feature service in AGOL).
Passing invalid arguments wouldn't present an error until code execution.
In this case, it just can't find the built-in function. It never makes it to the point of checking for missing arguments because it doesn't recognize that the function exists (in a profile that supports said function).
In the new Arcade Editor, you don't see an issue until the code tries to compile. Then you get the compilation error: "Compilation error - Line : x, y: Function not found". It like calling a user defined function before you define it.
Is this function just Broken at the moment? I think it might be.
- Justin Reynolds, PE