Upgrade 31.x --> 32.0.1 fails with db error from app_api

Upgrade from 31.x to 32.0.1 fails because of an error:

Updating <app_api> …
Exception: Database error when running migration 032002Date20250527174907 for app app_api
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1030 Got error 194 “Tablespace is missing for a table” from storage engine InnoDB
Update failed

I followed the hint from a similar issue: Upgrade failed because of app_api

and disabled app_api. The upgrade worked now, but I’m not able to reactivate app_api without the same error as described.

So I think, now I have an unstable system.

What can I do?

Holger

____________________________________________________

Steps to replicate it (hint: details matter!):

  1. Using webinterface for Update

  2. Using ./occ upgrade

Log output

Nextcloud
Aktualisierung auf 32.0.1

Exception: Database error when running migration 032002Date20250527174907 for app app_api An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1030 Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
Detaillierte Protokollmeldungen

Update vorbereiten

Log-Level auf "debug" gesetzt

Wartungsmodus eingeschaltet

Reparaturschritt: Repair MySQL collation

Reparaturinformation: All tables already have the correct collation -> nothing to do

Reparaturschritt: Copy data from accounts table when migrating from ownCloud

Reparaturschritt: Drop account terms table when migrating from ownCloud

Das Datenbankschema wird aktualisiert

Datenbank aktualisiert

"federation" aktualisiert auf 1.22.0

"lookup_server_connector" aktualisiert auf 1.20.0

Reparaturschritt: Update OAuth token expiration times

"oauth2" aktualisiert auf 1.20.0

"password_policy" aktualisiert auf 4.0.0-dev.0

Reparaturschritt: init metadata

"photos" aktualisiert auf 5.0.0-dev.1

"activity" aktualisiert auf 5.0.0-dev.0

Reparaturschritt: Upgrading Circles App

"circles" aktualisiert auf 32.0.0

"cloud_federation_api" aktualisiert auf 1.16.0

Reparaturschritt: Fix component of birthday calendars

Reparaturinformation: 2 birthday calendars updated.

Reparaturschritt: Regenerating birthday calendars to use new icons and fix old birthday events without year

Reparaturinformation: Repair step already executed

Reparaturschritt: Fix broken values of calendar objects

[0 / 0]: Fix broken values of calendar objects

Reparaturschritt: Registering building of calendar search index as background job

Reparaturinformation: Repair step already executed

Reparaturschritt: Register building of social profile search index as background job

Reparaturinformation: Repair step already executed

Reparaturschritt: Registering background jobs to update cache for webcal calendars

Reparaturinformation: Added 0 background jobs to update webcal calendars

Reparaturschritt: Registering building of calendar reminder index as background job

Reparaturinformation: Repair step already executed

Reparaturschritt: Register a background job to update rooms and resources

Reparaturschritt: Queue jobs to clean up orphan event and contact data

Reparaturschritt: Remove activity entries of private events

Reparaturinformation: Removed 0 activity entries

Reparaturschritt: Clean up old calendar subscriptions from deleted users that were not cleaned-up

[1 / 1]: Clean up old calendar subscriptions from deleted users that were not cleaned-up

[1 / 1]: Clean up old calendar subscriptions from deleted users that were not cleaned-up

Reparaturinformation: 0 calendar subscriptions without an user have been cleaned up

"dav" aktualisiert auf 1.34.2

"files" aktualisiert auf 2.4.0

Reparaturschritt: Fix the share type of guest shares when migrating from ownCloud

Reparaturschritt: Copy the share password into the dedicated column

Reparaturschritt: Set existing shares as accepted

"files_sharing" aktualisiert auf 1.24.0

"files_trashbin" aktualisiert auf 1.22.0

"files_versions" aktualisiert auf 1.25.0

"sharebymail" aktualisiert auf 1.22.0

"webhook_listeners" aktualisiert auf 1.3.0

Reparaturschritt: Populating added database structures for workflows

"workflowengine" aktualisiert auf 2.14.0

"comments" aktualisiert auf 1.22.0

"logreader" aktualisiert auf 5.0.0-dev.0

"nextcloud_announcements" aktualisiert auf 4.0.0-dev.0

"notifications" aktualisiert auf 5.0.0-dev.0

"systemtags" aktualisiert auf 1.22.0

Reparaturschritt: Initialize migration of background images from dashboard to theming app

"theming" aktualisiert auf 2.7.0

Exception: Database error when running migration 032002Date20250527174907 for app app_api An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1030 Got error 194 "Tablespace is missing for a table" from storage engine InnoDB

Das Update ist fehlgeschlagen. Bitte melde dieses Problem an die Nextcloud Community.

Config.php:

php occ config:list system
PHP Warning:  Module "redis" is already loaded in Unknown on line 0
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "verwaiser.de",
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "32.0.1.2",
        "overwrite.cli.url": "https:\/\/verwaiser.de",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "3306",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "maintenance": false,
        "theme": "",
        "loglevel": 2,
        "default_phone_region": "DE",
        "maintenance_window_start": 1,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtptimeout": 30,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": true,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

Apps

  • activity: 5.0.0-dev.0
  • bruteforcesettings: 5.0.0-dev.0
  • calendar: 6.0.2
  • circles: 32.0.0
  • cloud_federation_api: 1.16.0
  • comments: 1.22.0
  • contactsinteraction: 1.13.1
  • dashboard: 7.12.0
  • dav: 1.34.2
  • federatedfilesharing: 1.22.0
  • federation: 1.22.0
  • files: 2.4.0
  • files_downloadlimit: 5.0.0-dev.0
  • files_pdfviewer: 5.0.0-dev.0
  • files_reminders: 1.5.0
  • files_sharing: 1.24.0
  • files_trashbin: 1.22.0
  • files_versions: 1.25.0
  • firstrunwizard: 5.0.0-dev.0
  • logreader: 5.0.0-dev.0
  • lookup_server_connector: 1.20.0
  • nextcloud_announcements: 4.0.0-dev.0
  • notifications: 5.0.0-dev.0
  • oauth2: 1.20.0
  • password_policy: 4.0.0-dev.0
  • photos: 5.0.0-dev.1
  • privacy: 4.0.0-dev.0
  • profile: 1.1.0
  • provisioning_api: 1.22.0
  • recommendations: 5.0.0-dev.0
  • related_resources: 3.0.0-dev.0
  • serverinfo: 4.0.0-dev.0
  • settings: 1.15.1
  • sharebymail: 1.22.0
  • support: 4.0.0-dev.0
  • survey_client: 4.0.0-dev.0
  • systemtags: 1.22.0
  • text: 6.0.1
  • theming: 2.7.0
  • twofactor_backupcodes: 1.21.0
  • updatenotification: 1.22.0
  • user_status: 1.12.0
  • viewer: 5.0.0-dev.0
  • weather_status: 1.12.0
  • webhook_listeners: 1.3.0
  • workflowengine: 2.14.0
    Disabled:
  • admin_audit: 1.22.0
  • app_api: 32.0.0 (installed 5.0.2)
  • encryption: 2.20.0
  • files_external: 1.24.0
  • files_rightclick: 0.15.1 (installed 1.6.0)
  • suspicious_login: 10.0.0-dev.0
  • twofactor_nextcloud_notification: 6.0.0-dev.0
  • twofactor_totp: 14.0.0
  • user_ldap: 1.23.0

I’ve encountered the same or a similar error. Updating via the web interface of 1blu (German hosting provider) gets me the following error:

Bei der Verbindung über die Applikationsschnittstelle ist ein Fehler aufgetreten. ..Setting log level to debug Turned on maintenance mode Updating database schema Updated database Updating … Exception: Database error when running migration 070000Date20250925110024 for app text Migration step 'OCA\Text\Migration

(English translation of the error message: An error occured while connecting via API.)

I have the same problem. I was not able to resolve. Mine crashed here

Exception: Database error when running migration 1016Date202502262004 for app cloud_federation_api Migration step ‘OCA\CloudFederationAPI\Migration\Version1016Date202502262004’ is unknown Update failed Maintenance mode is kept active Resetting log level

  1. I turned off maintenance mode, and completed the upgrade from the web interface
  2. Nextcloud loads!
  3. Ran php occ maintenance:repair --include-expensive and php occ db:add-missing-indices
  4. Then notice the spreed is disabled, incompatible version, as well as passwords!
  5. I’m able to run occ app upgrade and spreed comes back… I am on passwords 2025.10.20 which requires 32 or lower it looks like 2025.10.10 is compatible with 33, no upgrade path
  6. I try and open spreed, get a 500 page not found, and also a 500 for passwords after force-enabling. Spreed (Talk) shows Could not find capabilities initial state fall back to _oc_capabilities in the web browser console

I restored from a previous nightly backup… hopefully root cause for this issue can be found

Moinsen!

I think, repairing the app_api is the only solution.

Chat CPT interpreted the message as follows:

“Die Meldung „Tablespace is missing for a table“ bedeutet, dass der Speicherort, in dem die Tabelle physisch abgelegt sein sollte, fehlt oder ungültig ist.
→ Meist ist das Problem durch Wiederherstellung oder Neuzuordnung eines gültigen Tablespaces behebbar.”

in english:

The message “Tablespace is missing for a table” means that the storage area (tablespace) where the table is supposed to reside is missing, invalid, or inaccessible.

In other words, the database metadata still references a tablespace that no longer exists or cannot be found on the system.

This usually happens if the tablespace was deleted, not mounted, its files were removed, or the database was restored/imported without recreating the original tablespace.

The issue can typically be fixed by recreating the missing tablespace or moving the affected table to a valid one.

I don’t know, if any of the nextcloud developers are monitoring this forum, but this updater-related-problem seems to need developers knowledge.
I need a hint, how to repair the tablespace for app_api.

Thanks for help, Holger

If the upgrade keeps failing with “tablespace is missing,” it means one of your app_api InnoDB tables has a corrupted or missing .ibd file, and MariaDB is refusing to run the migration. The normal fix is to drop the broken oc_app_api_* tables and let Nextcloud recreate them when the app is re-enabled, but if you absolutely need to recover the data (most people don’t for app_api), you can try exporting what’s left or repairing the table with a dedicated recovery tool like Stellar Repair for MySQL, which can rebuild corrupted InnoDB tablespaces when the .ibd file itself is damaged. After the bad table is repaired—or removed entirely—you can re-enable app_api and the system becomes stable again.

Hello Ajin,
thank you very much for your advice.
Unfortunately, I was not able to repair the oc_appconfig_ex table and I had to delete it.
Sadly, app_api still cannot be started; now I receive an error message saying that the table does not exist. This implies that it is not being automatically recreated.

This raises the question of how I can recreate the table. Since app_api is now part of the Nextcloud core, so I can not reinstall app_api, which is the approach suggested for other apps.

Perhaps someone from the community could provide their (empty) table as an SQL export file?

Thank you very much for your support,
Holger