Packages in the standard library also return errors for values with invalid types passed in as far as I’m aware of, take json.Unmarshall as an example.
That’s processing user input. It’s hard to say for sure without example, but it sounds to me like the OP means something more similar to the reflect package, which panics on incorrect usage.