In a recent paper, Juodis and Reese (2022, Journal of Business & Economic Statistics, 40, 1191–1203) (JR) show that the application of the CD test proposed by Pesaran (2004, General diagnostic tests for cross-sectional dependence in panels, CWPE 0435, Cambridge) to residuals from panels with latent factors results in over-rejection. They propose a randomized test statistic to correct for over-rejection, and add a screening component to achieve power. This article considers the same problem but from a different perspective and shows that the standard CD test remains valid if the latent factors are weak. A bias-corrected version, CD
$^{\ast}$, is proposed which is shown to be asymptotically standard normal under the null of error cross-sectional independence which has power against network-type alternatives. This result is shown to hold for pure latent factor models as well as for panel regression models with latent factors. The case where the errors are serially correlated is also considered. Small sample properties of the CD
$^{\ast}$ test are investigated by Monte Carlo experiments and are shown to have satisfactory small sample properties. In an empirical application, using the CD
$^{\ast}$ test, it is shown that there remains spatial error dependence in a panel data model for real house price changes across 377 Metropolitan Statistical Areas in the United States, even after the effects of latent factors are filtered out.