400 Bad Request error while enabling the rhel repository on the satellite6

Anju Chaurasiya
1 min readApr 28, 2021

Error in /var/log/foreman/production.log:

2021-04-20T15:52:32 [E|app|] RestClient::BadRequest: 400 Bad Request
Body: {"http_request_method": "POST", "exception": null, "error_message": "Relative URL [...../os] for repository ["repo_id1"] conflicts with existing relative URL [...../os] for repository ["repo_id2"]", "_href": "/pulp/api/v2/repositories/", "http_status": 400, "error": {"code": "PLP0000", "data": {}, "description": "Relative URL [...../os] for repository ["repo_id1"] conflicts with existing relative URL [...../os] for repository ["repo_id2"]", "sub_errors": []}, "args": ["Relative URL [...../os] for repository ["repo_id1"] conflicts with existing relative URL [...../os] for repository ["repo_id2"]"], "traceback": null}

Check the pulp database:

pass=$(grep ^default_password /etc/pulp/server.conf | cut -d' ' -f2)pulp-admin --username admin --password $pass repo list --repo-id <repo_id1>

If there is an entry in pulp database then clear the old entry of repository from the pulp db to make it consistent.

pass=$(grep ^default_password /etc/pulp/server.conf | cut -d' ' -f2)pulp-admin --username admin --password $pass rpm repo delete --repo-id <repo_id1>

Root Cause: The conflict happens if we had disabled the repository earlier and it was not cleared from database.

--

--