# Keycloak not starting after reboot of server. Error looks to be related to H2, "Constraint already exists"

**URL:** <https://forum.keycloak.org/t/keycloak-not-starting-after-reboot-of-server-error-looks-to-be-related-to-h2-constraint-already-exists/5011>\
**Category:** Miscellanaeous\
**Created:** [September 23, 2020, 6:31pm UTC](https://forum.keycloak.org/t/keycloak-not-starting-after-reboot-of-server-error-looks-to-be-related-to-h2-constraint-already-exists/5011 "2020-09-23T18:31:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfinn](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@dfinn](https://forum.keycloak.org/u/dfinn)\
**Post date:** [September 23, 2020, 6:31pm UTC](https://forum.keycloak.org/t/keycloak-not-starting-after-reboot-of-server-error-looks-to-be-related-to-h2-constraint-already-exists/5011/1 "2020-09-23T18:31:48Z")

</div>

Keycloak version 10.0.1

We have been using keycloak in a test environment for a while now with no issues. Recently some OS updates were applied to the server (Ubuntu 16.04) and a reboot was performed and since then we cannot get keycloak to start. As far as we can tell none of the OS updates should have touched anything related to keycloak.

When trying to start keycloak we get this error related to the H2 databse:

Caused by: org.h2.jdbc.JdbcSQLException: Constraint “FK\_5HG65LYBEVAVKQFKI3KPONH9V” already exists; SQL statement:  
ALTER TABLE PUBLIC.REALM\_REQUIRED\_CREDENTIAL ADD CONSTRAINT PUBLIC.FK\_5HG65LYBEVAVKQFKI3KPONH9V FOREIGN KEY(REALM\_ID) REFERENCES PUBLIC.REALM(ID) NOCHECK [90045-197]

I attempted to connect to the H2 database using the web UI for H2 and I get the same error. Unfortunately I know little about Keycloak but need to get this up and running again. Can anyone help with this?

---

<div class="post-metadata">

**Author:** ![donaldpapalilo](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@donaldpapalilo](https://forum.keycloak.org/u/donaldpapalilo)\
**Post date:** [November 3, 2020, 4:27pm UTC](https://forum.keycloak.org/t/keycloak-not-starting-after-reboot-of-server-error-looks-to-be-related-to-h2-constraint-already-exists/5011/2 "2020-11-03T16:27:08Z")

</div>

Hi,

I have the same error after the upgrade from version 4.8.3 to version 11.0.0 or 11.0.2. The application runs ok up to a possible restart when the same identical exception occurs.

Any advice is more than welcome.

Thank you

---

<div class="post-metadata">

**Author:** ![ibaselyous](https://avatars.discourse-cdn.com/v4/letter/i/eada6e/32.png) [@ibaselyous](https://forum.keycloak.org/u/ibaselyous)\
**Post date:** [July 21, 2021, 1:01pm UTC](https://forum.keycloak.org/t/keycloak-not-starting-after-reboot-of-server-error-looks-to-be-related-to-h2-constraint-already-exists/5011/3 "2021-07-21T13:01:03Z")

</div>

same on after upgrading from 12.0.4 to 13.0.1 or 14.0.0
