Issue #24872:improve error messages