Bitbucket Server fails to start - Missing column or missing table
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
The following appears in the atlassian-bitbucket.log
when starting Bitbucket Server:
1
2
3
4
5
6
7
8
9
10
11
12
Caused by: org.hibernate.HibernateException: Missing column: slug in STASH.STASH_USER
at org.hibernate.mapping.Table.validateColumns(Table.java:365) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1336) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:525) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:339) ~[spring-orm-4.0.0.RELEASE.jar:4.0.0.RELEASE]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:427) ~[spring-orm-4.0.0.RELEASE.jar:4.0.0.RELEASE]
at com.atlassian.bitbucket.internal.hibernate.ExtendedLocalSessionFactoryBean.buildSessionFactory(ExtendedLocalSessionFactoryBean.java:90) ~[bitbucket-dao-impl-2.11.4.jar:na]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:412) ~[spring-orm-4.0.0.RELEASE.jar:4.0.0.RELEASE]
... 9 common frames omitted
Below are some additional entries we've seen related to this problem.
1
2
3
4
5
Caused by: org.hibernate.HibernateException: Missing column: remote_address_binary in public.cwd_application_address
Caused by: org.hibernate.HibernateException: Missing column: origin_id in public.repository
Caused by: org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity
Cause
There is a mismatch between the application version being used to start Bitbucket Server and the database. Most likely, a newer version of Bitbucket Server was started which was pointed at this database and ran the needed database upgrade tasks. This can result in various columns being dropped from the database. Alternatively, it's possible that an older version of Bitbucket Server has accidentally been started.
Resolution
If an older version of Bitbucket Server has accidentally be started, locate and start the newest version of Bitbucket Server installed on the server.
If the database was unintentionally upgraded to a newer version of Bitbucket Server, there are two paths forward:
Restore a backup of both the filesystem and database according to Data recovery and backups to a time before the upgrade
Perform the full upgrade to the latest version of Bitbucket Server that has been connected to the database
If you cannot get Bitbucket Server to start open a support request at https://support.atlassian.com and provide a dump of the databasechangelog
table which Support will use to identify the correct version.
Was this helpful?