-
-
Notifications
You must be signed in to change notification settings - Fork 94
Description
Before the Zod package version 4.0.5
upgrade (when Zod v4 was still used with the zod/v4
import), URL form fields would work normally and filling out an invalid URL would return the error Invalid URL
.
After upgrading the package version (and the imports from zod/v4
to zod
, though the issue remains even if that step is skipped), the error for an invalid URL is returned as Invalid input
, which does not signal that something is wrong with the URL format per se.
This does not appear to be an issue with Zod itself as the same schema is also used for an API, which returns specific error messages as well and there Invalid URL
remains as the correct error message.
Can be trialed out in this MRE with https://host name
as the URL input to trigger the error while passing the HTML type="url"
validation. In the example I also provide different ways of specifying the URL schema and the issue appears to be present on all of them unless a custom error message is specified, in which case that will be displayed instead of Invalid input
.