How to diagnose the «Internal Error. Details are available in Magento log file. Report ID: XXX» exception?

A report ID is a 12-digits number (an example: 147414693386).
The reports are stored in the var/report folder.
The var/report folder is autogenerated, so you can safely delete it, and it will be recreated when the system will need to create a new report.

To diagnose a problem, you should find the a report file by the Report ID given:

A report is a plain text file, for example:

a:4:{i:0;s:188:"Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/vhosts/temporarytattoos.com/vendor/magento/module-captcha/Observer/CheckUserLoginObserver.php on line 80";i:1;s:12897:"#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'array_key_exist...', '/var/www/vhosts...', 80, Array)
#1 /var/www/vhosts/temporarytattoos.com/vendor/magento/module-captcha/Observer/CheckUserLoginObserver.php(80): array_key_exists('username', NULL)
#2 /var/www/vhosts/temporarytattoos.com/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\Captcha\Observer\CheckUserLoginObserver->execute(Object(Magento\Framework\Event\Observer))
#3 <...>