This doesn’t look like the correct part of the log, this is the loading of the edit form. there should be a request that completes with failure that contains the full error stack trace. you might need to enable debug logging level and restart the foreman server first.
What version of foreman are you using? are there any plugins installed?
Foreman 1.12.4 is very old (over 3 years now!) and is no longer supported.
Most chances are that this is a bug that has been fixed since, and no-one will have an environment running such an old version to even try and debug the issue you are facing.
I highly recommend updating to a supported version, such as 1.24.2.
You will need to upgrade one version at a time, starting from 1.13 manual and going forward using the manual for every version. Please also take note of the upgrade warning and deprecations in each version.
Another option is to set up a new Foreman instance with the latest version and migrate your hosts to it.
Which path would be easier depends on your infrastructure.
By setting up a new instance i mean that you will need to reconfigure all of your hosts to talk to the new instance and set up all of the configuration from scratch on it. there is no simple migration that will take the db and migrate it to the new format. for that you will need to go through all the different version, as well as upgrade your underlying os in the process.
There are known cases where a postgresql database dump on an old version imported on a fresh install have worked. You do need to run foreman-rake db:migrate && foreman-rake db:seed and probably the installer again. You are also responsible for making sure things still work as intended since it’s not really a supported path.