bartlett's test: warning message

I would like to see whether my data is suitable for principal commpent analysis or not. For this purpose, I am using following three criteria: Bartlett's test, KMO (Kaiser-Meyer-Olkin) and Determinnant. KMO and
Determinnant tests are OK.

But when I run Bartlett's test using following R command I get warning message.
cortest.bartlett(df), where df is a data frame

The warning messages are:

$chisq [1]
$p.value [1] NaN

In log(detR) : NaNs produced

My undrestating is that when R is trying to take a log of determinant of correlation matrix of a data frame, when it encounters negative values then this type of warning messages are produced.
Could any suggest how to fix this issue please.

Hi Abdur,
You will need to provide at least some of your data plus code in a reproducible example (reprex) so that Forum members can recreate the error you encountered and then suggest a solution.