Your function returns nil on the success path, the caller checks err != nil, and the check fires anyway. What happened?
An interface value carries a type alongside a pointer, so an interface holding a nil pointer of a concrete type is itself not nil. Returning a typed nil pointer into an error return produces a value that is non-nil to every caller while being nil to the function that produced it.