Skip to content

[Bug]: Oracle "Error while running background job OC\User\BackgroundJobs\CleanupLoginTokens: inconsistent datatypes: expected - got CLOB #64093

Description

@pollopolea

⚠️ This issue respects the following points: ⚠️

  • This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
  • This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
  • I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
  • I agree to follow Nextcloud's Code of Conduct.
  • I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.

Bug description

[Bug]: Oracle "Error while running background job OC\User\BackgroundJobs\CleanupLoginTokens: inconsistent datatypes: expected - got CLOB

When running the cron command, an error occurs ORA-00932

SQL> describe "oc_authtoken" ;
Nombre ?Nulo? Tipo


id NOT NULL NUMBER(20)
uid NOT NULL VARCHAR2(64)
login_name NOT NULL VARCHAR2(255)
password CLOB
name NOT NULL CLOB
token NOT NULL VARCHAR2(200)
type NUMBER(5)
remember NUMBER(5)
last_activity NUMBER(10)
last_check NUMBER(10)
scope CLOB
expires NUMBER(10)
private_key CLOB
public_key CLOB
version NOT NULL NUMBER(5)
password_invalid NUMBER(1)
password_hash VARCHAR2(255)

SQL> describe "oc_preferences"
Nombre ?Nulo? Tipo


userid NOT NULL VARCHAR2(64)
appid NOT NULL VARCHAR2(32)
configkey NOT NULL VARCHAR2(64)
configvalue CLOB
lazy NOT NULL NUMBER(5)
type NOT NULL NUMBER(5)
flags NOT NULL NUMBER(10)
indexed VARCHAR2(64)

Line 36 of /lib/private/User/BackgroundJobs/CleanupLoginTokens.
32 $qb
33 ->delete('preferences')
34 ->where($qb->expr()->eq('appid', $qb->expr()->literal('login_token')))
35 ->andWhere($qb->expr()->lt('configvalue', $qb->createNamedParameter(time() - $rememberMeMaxAge)))
36 ->executeStatement();

equivalence in SQL:
DELETE FROM oc_preferences WHERE appid = 'login_token' AND configvalue < :dcValue1

In Oracle, using the CLOB data type in the oc_Preferences table is a problem. In Oracle, CLOBs cannot use direct comparison operators such as =, !=, <, >, BETWEEN, or INT, nor can they be used in GROUP BY, ORDER BY, or DISTINCT clauses...

Steps to reproduce

Expected behavior

sudo -u apache /usr/bin/php /nextcloud/cron.php

Nextcloud Server version

34

Operating system

RHEL/CentOS

PHP engine version

PHP 8.5

Web server

Apache (supported)

Database engine version

Oracle

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

No response

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "localstorage.allowsymlinks": true,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "oci",
        "version": "34.0.2.1",
        "htaccess.RewriteBase": "\/",
        "overwritewebroot": "\/",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "ES",
        "auth.bruteforce.protection.enabled": true,
        "auth.bruteforce.max-attempts": 5,
        "forcessl": true,
        "ratelimit.protection.enabled": true,
        "logtimezone": "Europe\/Madrid",
        "loglevel": 3,
        "log_type": "file",
        "logfile": "\/var\/log\/nextcloud.log",
        "installed": true,
        "skeletondirectory": "",
        "templatedirectory": "",
        "trashbin_retention_obligation": "auto,30",
        "versions_retention_obligation": "auto",
        "defaultapp": "files",
        "enable_previews": false,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache_customprefix": "nc2_",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***",
        },
        "redis.session.locking_enabled": 1,
        "redis.session.lock_retries": -1,
        "redis.session.lock_wait_time": 10000,
        "config_preset": 8,
    }
}

List of activated Apps

Enabled:
  - activity: 7.0.0
  - admin_audit: 1.24.0
  - appstore: 1.0.0
  - bruteforcesettings: 7.0.0
  - cloud_federation_api: 1.18.0
  - dav: 1.39.0
  - federatedfilesharing: 1.24.0
  - files: 2.6.0
  - files_downloadlimit: 5.2.0
  - files_lock: 34.0.1
  - files_sharing: 1.26.0
  - files_trashbin: 1.24.0
  - files_versions: 1.27.0
  - guests: 4.9.0
  - lookup_server_connector: 1.22.0
  - notifications: 7.0.0-dev.1
  - oauth2: 1.22.0
  - profile: 1.3.0
  - provisioning_api: 1.24.0
  - serverinfo: 6.0.0
  - settings: 1.17.0
  - text: 8.0.0
  - theming: 2.9.0
  - twofactor_backupcodes: 1.23.0
  - twofactor_nextcloud_notification: 8.0.0
  - twofactor_totp: 16.0.0
  - user_ldap: 1.25.0
  - viewer: 7.0.0-dev.0
  - workflowengine: 2.16.0

Nextcloud Signing status

Nextcloud Logs

{"reqId":"kANgHDJ2mrKaf60mvKZr","level":3,"time":"2026-09-07T10:30:02+02:00","remoteAddr":"","user":"--","app":"core","method":"","url":"/cron.php","scriptName":"/cron.php","message":"Error while running background job OC\\User\\BackgroundJobs\\CleanupLoginTokens (id: 115372286665789440, arguments: null)","userAgent":"--","version":"34.0.2.1","occ_command":["/nextcloud/cron.php"],"exception":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a query: ORA-00932: tipos de dato inconsistentes: se esperaba - se ha obtenido CLOB\nHelp: https://docs.oracle.com/error-help/db/ora-00932/","Code":932,"Trace":[{"file":"/var/www/html/nextcloud-34.0.2/lib/private/DB/ConnectionAdapter.php","line":78,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/DB/QueryBuilder/QueryBuilder.php","line":279,"function":"executeStatement","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/User/BackgroundJobs/CleanupLoginTokens.php","line":36,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/Job.php","line":50,"function":"run","class":"OC\\User\\BackgroundJobs\\CleanupLoginTokens","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/TimedJob.php","line":86,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/core/Service/CronService.php","line":204,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/core/Service/CronService.php","line":107,"function":"runCli","class":"OC\\Core\\Service\\CronService","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/cron.php","line":52,"function":"run","class":"OC\\Core\\Service\\CronService","type":"->"}],"File":"/var/www/html/nextcloud-34.0.2/lib/private/DB/Exceptions/DbalException.php","Line":50,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: ORA-00932: tipos de dato inconsistentes: se esperaba - se ha obtenido CLOB\nHelp: https://docs.oracle.com/error-help/db/ora-00932/","Code":932,"Trace":[{"file":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connection.php","line":1976,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\OCI\\ExceptionConverter","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connection.php","line":1918,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connection.php","line":1218,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php","line":292,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/DB/Connection.php","line":469,"function":"executeStatement","class":"Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/DB/ConnectionAdapter.php","line":76,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/DB/QueryBuilder/QueryBuilder.php","line":279,"function":"executeStatement","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/User/BackgroundJobs/CleanupLoginTokens.php","line":36,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/Job.php","line":50,"function":"run","class":"OC\\User\\BackgroundJobs\\CleanupLoginTokens","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/TimedJob.php","line":86,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/core/Service/CronService.php","line":204,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/core/Service/CronService.php","line":107,"function":"runCli","class":"OC\\Core\\Service\\CronService","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/cron.php","line":52,"function":"run","class":"OC\\Core\\Service\\CronService","type":"->"}],"File":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php","Line":104,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\OCI8\\Exception\\Error","Message":"ORA-00932: tipos de dato inconsistentes: se esperaba - se ha obtenido CLOB\nHelp: https://docs.oracle.com/error-help/db/ora-00932/","Code":932,"Trace":[{"file":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Driver/OCI8/Statement.php","line":169,"function":"new","class":"Doctrine\\DBAL\\Driver\\OCI8\\Exception\\Error","type":"::"},{"file":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connection.php","line":1212,"function":"execute","class":"Doctrine\\DBAL\\Driver\\OCI8\\Statement","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php","line":292,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/DB/Connection.php","line":469,"function":"executeStatement","class":"Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/DB/ConnectionAdapter.php","line":76,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/DB/QueryBuilder/QueryBuilder.php","line":279,"function":"executeStatement","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/private/User/BackgroundJobs/CleanupLoginTokens.php","line":36,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/Job.php","line":50,"function":"run","class":"OC\\User\\BackgroundJobs\\CleanupLoginTokens","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/TimedJob.php","line":86,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/core/Service/CronService.php","line":204,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/core/Service/CronService.php","line":107,"function":"runCli","class":"OC\\Core\\Service\\CronService","type":"->"},{"file":"/var/www/html/nextcloud-34.0.2/cron.php","line":52,"function":"run","class":"OC\\Core\\Service\\CronService","type":"->"}],"File":"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Driver/OCI8/Exception/Error.php","Line":21}},"message":"Error while running background job OC\\User\\BackgroundJobs\\CleanupLoginTokens (id: 115372286665789440, arguments: null)","exception":"{\"class\":\"OC\\DB\\Exceptions\\DbalException\",\"message\":\"An exception occurred while executing a query: ORA-00932: tipos de dato inconsistentes: se esperaba - se ha obtenido CLOB\\nHelp: https://docs.oracle.com/error-help/db/ora-00932/\",\"code\":932,\"file\":\"/var/www/html/nextcloud-34.0.2/lib/private/DB/Exceptions/DbalException.php:50\",\"trace\":\"#0 /var/www/html/nextcloud-34.0.2/lib/private/DB/ConnectionAdapter.php(78): OC\\DB\\Exceptions\\DbalException::wrap()\\n#1 /var/www/html/nextcloud-34.0.2/lib/private/DB/QueryBuilder/QueryBuilder.php(279): OC\\DB\\ConnectionAdapter->executeStatement()\\n#2 /var/www/html/nextcloud-34.0.2/lib/private/User/BackgroundJobs/CleanupLoginTokens.php(36): OC\\DB\\QueryBuilder\\QueryBuilder->executeStatement()\\n#3 /var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/Job.php(50): OC\\User\\BackgroundJobs\\CleanupLoginTokens->run()\\n#4 /var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/TimedJob.php(86): OCP\\BackgroundJob\\Job->start()\\n#5 /var/www/html/nextcloud-34.0.2/core/Service/CronService.php(204): OCP\\BackgroundJob\\TimedJob->start()\\n#6 /var/www/html/nextcloud-34.0.2/core/Service/CronService.php(107): OC\\Core\\Service\\CronService->runCli()\\n#7 /var/www/html/nextcloud-34.0.2/cron.php(52): OC\\Core\\Service\\CronService->run()\\n#8 {main}\",\"previous\":{\"class\":\"Doctrine\\DBAL\\Exception\\DriverException\",\"message\":\"An exception occurred while executing a query: ORA-00932: tipos de dato inconsistentes: se esperaba - se ha obtenido CLOB\\nHelp: https://docs.oracle.com/error-help/db/ora-00932/\",\"code\":932,\"file\":\"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php:104\",\"trace\":\"#0 /var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connection.php(1976): Doctrine\\DBAL\\Driver\\API\\OCI\\ExceptionConverter->convert()\\n#1 /var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connection.php(1918): Doctrine\\DBAL\\Connection->handleDriverException()\\n#2 /var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connection.php(1218): Doctrine\\DBAL\\Connection->convertExceptionDuringQuery()\\n#3 /var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php(292): Doctrine\\DBAL\\Connection->executeStatement()\\n#4 /var/www/html/nextcloud-34.0.2/lib/private/DB/Connection.php(469): Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection->executeStatement()\\n#5 /var/www/html/nextcloud-34.0.2/lib/private/DB/ConnectionAdapter.php(76): OC\\DB\\Connection->executeStatement()\\n#6 /var/www/html/nextcloud-34.0.2/lib/private/DB/QueryBuilder/QueryBuilder.php(279): OC\\DB\\ConnectionAdapter->executeStatement()\\n#7 /var/www/html/nextcloud-34.0.2/lib/private/User/BackgroundJobs/CleanupLoginTokens.php(36): OC\\DB\\QueryBuilder\\QueryBuilder->executeStatement()\\n#8 /var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/Job.php(50): OC\\User\\BackgroundJobs\\CleanupLoginTokens->run()\\n#9 /var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/TimedJob.php(86): OCP\\BackgroundJob\\Job->start()\\n#10 /var/www/html/nextcloud-34.0.2/core/Service/CronService.php(204): OCP\\BackgroundJob\\TimedJob->start()\\n#11 /var/www/html/nextcloud-34.0.2/core/Service/CronService.php(107): OC\\Core\\Service\\CronService->runCli()\\n#12 /var/www/html/nextcloud-34.0.2/cron.php(52): OC\\Core\\Service\\CronService->run()\\n#13 {main}\",\"previous\":{\"class\":\"Doctrine\\DBAL\\Driver\\OCI8\\Exception\\Error\",\"message\":\"ORA-00932: tipos de dato inconsistentes: se esperaba - se ha obtenido CLOB\\nHelp: https://docs.oracle.com/error-help/db/ora-00932/\",\"code\":932,\"file\":\"/var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Driver/OCI8/Exception/Error.php:21\",\"trace\":\"#0 /var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Driver/OCI8/Statement.php(169): Doctrine\\DBAL\\Driver\\OCI8\\Exception\\Error::new()\\n#1 /var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connection.php(1212): Doctrine\\DBAL\\Driver\\OCI8\\Statement->execute()\\n#2 /var/www/html/nextcloud-34.0.2/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php(292): Doctrine\\DBAL\\Connection->executeStatement()\\n#3 /var/www/html/nextcloud-34.0.2/lib/private/DB/Connection.php(469): Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection->executeStatement()\\n#4 /var/www/html/nextcloud-34.0.2/lib/private/DB/ConnectionAdapter.php(76): OC\\DB\\Connection->executeStatement()\\n#5 /var/www/html/nextcloud-34.0.2/lib/private/DB/QueryBuilder/QueryBuilder.php(279): OC\\DB\\ConnectionAdapter->executeStatement()\\n#6 /var/www/html/nextcloud-34.0.2/lib/private/User/BackgroundJobs/CleanupLoginTokens.php(36): OC\\DB\\QueryBuilder\\QueryBuilder->executeStatement()\\n#7 /var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/Job.php(50): OC\\User\\BackgroundJobs\\CleanupLoginTokens->run()\\n#8 /var/www/html/nextcloud-34.0.2/lib/public/BackgroundJob/TimedJob.php(86): OCP\\BackgroundJob\\Job->start()\\n#9 /var/www/html/nextcloud-34.0.2/core/Service/CronService.php(204): OCP\\BackgroundJob\\TimedJob->start()\\n#10 /var/www/html/nextcloud-34.0.2/core/Service/CronService.php(107): OC\\Core\\Service\\CronService->runCli()\\n#11 /var/www/html/nextcloud-34.0.2/cron.php(52): OC\\Core\\Service\\CronService->run()\\n#12 {main}\"}}}","CustomMessage":"Error while running background job OC\\User\\BackgroundJobs\\CleanupLoginTokens (id: 115372286665789440, arguments: null)"}}

Additional info

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap34-feedbackbug

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions