Skip to content

AppConfigTypeConflictException #2055

@alaindehu-eng

Description

@alaindehu-eng

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

This report was generated by Claude.AI, which helped me fix this bug.
I have to admit that I don't have the skills for this at all.

Steps to reproduce

  1. Install LogCleaner 1.5.1 on Nextcloud 34
  2. Navigate to the LogCleaner app page
  3. The app immediately throws an exception.

Expected behaviour

The LogCleaner app should load and display the Nextcloud log normally.

Actual behaviour

Every time the app loads, it throws an AppConfigTypeConflictException:

"Exception":"OCP\\Exceptions\\AppConfigTypeConflictException",
"Message":"conflict with value type from database",
"File":"/var/www/nextcloud/lib/private/AppConfig.php",
"Line":537

The exception is triggered at:

  • SettingsController.php line 71 → getValueInt()
  • SettingsController.php line 87 → setSettingZeilen()

Root cause: In setSettingZeilen(), when $zeilen is a string (which is always the case when called from getAppValueZ() with default values like '5', '2', '1', etc.), the method correctly calls setValueString() to store the value. However, immediately after, it tries to read wtparam_logmessage using getValueInt():

// PROBLEMATIC CODE — 3 occurrences in setSettingZeilen():
if ( $this->appConfig->getValueInt('logcleaner', 'wtparam_logmessage', 2) === 2 )

Since wtparam_logmessage was stored as a string via setValueString(), calling getValueInt() on it causes Nextcloud 34 to throw AppConfigTypeConflictException. Nextcloud 34 enforces strict type checking on config values, which was not enforced in earlier versions.

Fix: In SettingsController.php, replace the 3 occurrences of getValueInt() for wtparam_logmessage inside setSettingZeilen() with a properly cast getValueString() call:

// BEFORE (3 times):
if ( $this->appConfig->getValueInt('logcleaner', 'wtparam_logmessage', 2) === 2 )

// AFTER (3 times):
if ( (int)$this->appConfig->getValueString('logcleaner', 'wtparam_logmessage', '2') === 2 )

After applying the fix, existing config entries must be cleared so they are recreated with the correct types:

mysql -u nextcloud -p nextcloud -e "DELETE FROM oc_appconfig WHERE appid = 'logcleaner';"
sudo -u www-data php /var/www/nextcloud/occ app:disable logcleaner
sudo -u www-data php /var/www/nextcloud/occ app:enable logcleaner

The app then works correctly.

Additional note: A broader review of the codebase may be warranted, as the same type-mixing pattern (storing values as strings then reading them with typed getters) may exist elsewhere in the controller and could cause similar issues on Nextcloud 34+.

Server configuration

Web server: Apache
Database: MariaDB 10.11
PHP version: 8.4.22
Nextcloud version: 34.0.0.12

List of activated apps N/A
Details N/A

Browser

Browser name: Zen Browser (Firefox-based)
Browser version: 1.21b (Firefox 151.0.4)
Operating system: Linux x86_64

Browser log
N/A — the error is server-side only, visible in Nextcloud log.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions