PG::NotNullViolation: ERROR: null value in column "root_id" violates not-null constraint

Problem:
On a fresh Foreman 3.3, Katello 4.5 setup,
I added a subscription manifest and tried to add repositories.
when clicking on the + icon of any repository, the operation to add the repo fails with the error:

PG::NotNullViolation: ERROR: null value in column "root_id" violates not-null constraint

full trace here: ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR: null value in column "root_id" violate - Pastebin.com

Expected outcome:
being able to add repositories

Foreman and Proxy versions:

  • foreman 3.3
  • smart-proxy 3.3

Foreman and Proxy plugin versions:

  • katello 4.5
  • smart_proxy_pulp 3.2.0
  • foreman_remote_execution 7.2.2
  • smart_proxy_remote_execution_ssh 0.7.3
  • foreman-tasks 6.0.3

Hi @Ron_Lavi, did the parent CreateRoot task fail, or any other tasks? CreateRoot saves the RootRepository and passes it on to the Repository in Repository::Create. Looking at the code, either the root was somehow deleted between it being saved and it being passed to the repository, or, somehow the root was never created at all.