errors.Is is supposed to used for equality of errors, not for type assertions. That's what errors.As is there for.