I have also had that error, when I was trying out PureOS on an old laptop. I think it happens due to a bug that has been reported before, for example here:
Unfortunately there is no fix yet, as far as I know.
The good news is that although this is annoying it’s just a failure of the command-not-found feature which is supposed to give you a message like this:
xyzabc: command not found
or if it’s available in some package that can be installed, it should say this:
Command ‘xyzabc’ not found, but can be installed with:
sudo apt install xyzabc
So you can live without that feature. When you get that strange error message about command-not-found and local variable ‘cnf’ and so on, it just means that the command you tried to use is not available. Try using “apt install” to install the package first.
To get rid of the confusing error message, I think you can safely remove the command-not-found package. Then you will just get the “xyzabc: command not found” message everytime, skipping the fancy feature of checking if there is a package that can be installed to get the command working.
Which command is it that you are trying to use when getting the command-not-found error message?