Error: "The application "(null)" does not have permission....."

I have a script which finds a file and gets its POSIX path. The script then needs to open the file with the relevant default application. It currently does so using Finder:

tell application "Finder"
	open pathToFile as alias
end tell

Sometimes when the file is on an external drive, it get this error:

The application "(null)" does not have permission to open "[name of file]".

Does that mean Finder could not determine the default application ? I have checked to ensure that all relevant applications do have external volume permissions [Full disk Access].

Would using System Events be better ?

Should I just send the file to Finder instead of its alias ?

I can’t see a pattern. It just happens sometimes and sometimes not. Why does it not happen in every case ?

Thanks.