# Bug OP-13178 - After upgrade to 12.5.8: error occurred during openproject configure 

Project: OpenProject
Status: rejected
URL: https://community.openproject.org/work_packages/OP-13178

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions |  |
| Observed in versions | 12.5.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) | 12.5.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Start `sudo openproject configure` after upgrade

### What is the buggy behavior?

  - Browser gives a "503 Service Unavailable" error on browsing the OpenProject instance

### What is the expected behavior?

1.  OpenProject service is available again

### **Logs**

`sudo openproject configure` delivers following output (for complete log see attachment "output openproject configure.txt"):

``` text
--snip--
[openproject] ./bin/postinstall
I, [2023-08-26T18:58:49.829958 #55259]  INFO -- : Migrating to UniqueIndexOnCustomFieldsProjects (20230309104056)
== 20230309104056 UniqueIndexOnCustomFieldsProjects: migrating ================
-- execute("WITH selection AS ( SELECT project_id, custom_field_id FROM custom_fields_projects GROUP BY (project_id, custom_field_id) ), deletion AS ( DELETE FROM custom_fields_projects ), insertion AS ( INSERT INTO custom_fields_projects ( project_id, custom_field_id ) SELECT project_id, custom_field_id FROM selection ) SELECT 1")
   -> 0.0010s
-- remove_index(:custom_fields_projects, [:custom_field_id, :project_id])
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Multiple indexes found on custom_fields_projects columns [:custom_field_id, :project_id]. Specify an index name from index_custom_fields_projects_on_custom_field_id_and_project_id, index_custom_fields_projects_on_custom_field_id_and_project_id
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.7/lib/active_record/connection_adapters/abstract/schema_statements.rb:1460:in `index_name_for_remove'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.7/lib/active_record/connection_adapters/postgresql/schema_statements.rb:470:in `remove_index'
--snip--
```

`sudo openproject logs --tail` shows the following lines (snippet, see "output openproject logs.txt" for full output):

``` text
--snip--
Aug 26 19:03:02 ubuntu-op openproject-web-1.service[55569]:         from bin/rails:9:in `<main>'
Aug 26 19:03:02 ubuntu-op systemd[1]: openproject-web-1.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 19:03:02 ubuntu-op systemd[1]: openproject-web-1.service: Failed with result 'exit-code'.
Aug 26 19:03:02 ubuntu-op systemd[1]: openproject-web-1.service: Scheduled restart job, restart counter is at 5.
Aug 26 19:03:02 ubuntu-op systemd[1]: Stopped openproject-web-1.service.
Aug 26 19:03:02 ubuntu-op systemd[1]: Started openproject-web-1.service.
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: => Booting Puma
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: => Rails 7.0.7 application starting in production
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: => Run `bin/rails server --help` for more startup options
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: Exiting
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: /opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.7/lib/active_record/migration.rb:627:in `check_pending!':  (ActiveRecord::PendingMigrationError)
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: Migrations are pending. To resolve this issue, run:
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]:         bin/rails db:migrate RAILS_ENV=production
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: You have 23 pending migrations:
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230309104056_unique_index_on_custom_fields_projects.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230314093106_add_update_delete_cascade_to_work_packages_project_id.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230314165213_add_foreign_keys_to_work_packages.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230315103437_add_foreign_keys_to_workflows.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230315183431_add_foreign_keys_to_projects_types.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230315184533_add_foreign_keys_to_custom_fields_projects.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230322135932_merge_wiki_content_into_page.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230328154645_add_gin_trgm_index_on_journals_and_custom_values.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230508150835_copy_project_status_into_projects_and_journals.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230531093004_remove_default_from_query_name.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230606083221_add_cause_to_journal.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230608151123_add_validity_period_to_journals.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230613155001_add_export_logo_to_custom_style.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230713144232_create_storages_file_link_journals.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230717104700_drop_export_card_configurations.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230718084649_add_create_user_permission_to_roles.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230725165505_add_storage_name_to_storages_file_links_journals.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230726061920_rename_auth_source_to_ldap_auth_source.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230726112130_remove_type_from_ldap_auth_sources.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230731153909_add_file_link_journals_to_existing_containers.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230803113215_add_indices_to_work_package_journals.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230808080001_remove_some_string_length_constraints.rb
Aug 26 19:03:05 ubuntu-op openproject-web-1.service[55599]: 20230808140921_add_derived_remaining_hours_to_work_packages.rb
--snip--
```

### Environment information

**OpenProject installation type**

- [ ] Hosted cloud edition
- [x] Packaged installation
    - Ubuntu 20.04
- [ ] Docker All-in-one container
- [ ] Docker-compose installation
- [ ] Other (please specify)

**OpenProject version**

*v12.5.8*

**Browser**

- [x] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Mobile Safari
- [ ] Other (please specify)

**Language**

*German*

**Additional Information**

I already mentioned the issue in <https://community.openproject.org/topics/17620> (just to avoid confussion).
