Improve the tree view error messages (see #6620)