nextcloud / integration_gitlab

🦊 GitLab integration into Nextcloud
https://apps.nextcloud.com/apps/integration_gitlab
GNU Affero General Public License v3.0
41 stars 8 forks source link

[Bug]: Convert multi accounts -> `SQLSTATE[HY000]: General error: 1364 Field 'token_type' doesn't have a default value` #95

Closed koelle25 closed 2 weeks ago

koelle25 commented 2 weeks ago

⚠️ This issue respects the following points: ⚠️

Bug description

My admin web interface says:

One or more mimetype migrations are available. Occasionally new mimetypes are added to better handle certain file types. Migrating the mimetypes take a long time on larger instances so this is not done automatically during upgrades. Use the command occ maintenance:repair --include-expensive to perform the migrations.

If I do it, the following error appears while running (full output is below):

$ ./occ maintenance:repair --include-expensive -vvv ...

  • Convert multi accounts
    • ERROR: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'token_type' doesn't have a default value ...
      Full maintenance:repair command output
 - Repair MySQL collation
     - All tables already have the correct collation -> nothing to do
 - Clean tags and favorites
     - 0 tags of deleted users have been removed.
     - 0 tags for delete files have been removed.
     - 0 tag entries for deleted tags have been removed.
     - 0 tags with no entries have been removed.
 - Repair invalid shares
 - Move .step file of updater to backup location
 - Add move avatar background job
     - Repair step already executed
 - Add preview cleanup background jobs
 - Migrate oauth2_clients table to nextcloud schema
     - Update the oauth2_access_tokens table schema.
     - Update the oauth2_clients table schema.
     - Delete clients (and their related access tokens) with the redirect_uri starting with oc:// or ending with *
 - Fix potential broken mount points
     - No mounts updated
 - Repair language codes
 - Add log rotate job
 - Clear frontend caches
     - Image cache cleared
     - JS cache cleared
 - Clear every generated avatar
 - Add preview background cleanup job
 - Queue a one-time job to cleanup old backups of the updater
 - Cleanup invalid photocache files for carddav
 - Add background job to cleanup login flow v2 tokens
 - Remove potentially over exposing share links
     - No need to remove link shares.
 - Clear access cache of projects
 - Reset generated avatar flag
 - Keep legacy encryption enabled
 - Check encryption key format
 - Remove old dashboard app config data
 - Add job to cleanup the bruteforce entries
 - Queue a one-time job to check for user uploaded certificates
 - Repair DAV shares
 - Add background job to set the lookup server share state for users
 - Add token cleanup job
 - Clean up abandoned apps
 - Add possibly missing system config
 - Add AI tasks cleanup job
 - Queue a job to generate metadata
 - Cache logo dimension to fix size in emails on Outlook
     - Logo dimensions are already known
 - Remove shares of old group memberships
 - Repair mime types
 - Validate the phone number and store it in a known format for search
 - Handle outdated scheduling events
     - Cleaning up old scheduling events
 - Add read permissions for existing announcements
    0 [->--------------------------] < 1 sec 121.0 MiB
 - Deduplicate shared bookmark folders
     - Removed 0 duplicate shares
 - Remove superfluous shared bookmark folders
     - Removed 0 superfluous shares
 - Remove orphaned bookmark shares
     - Removed 0 orphaned shares
     - Removed 0 orphaned public links
 - Remove orphaned bookmark tree items
     - Removed 0 orphaned bookmarks entries
     - Removed 0 orphaned folders entries
     - Reinserted 0 orphaned children entries
     - Removed 0 orphaned bookmark folders
     - Reinserted 0 orphaned bookmarks
 - Update bookmark group shares
     - Removed 0 users and added 0 users to 0 groups
     - Removed 0 shares
 - Upgrading Circles App
 - Fix component of birthday calendars
     - 397 birthday calendars updated.
 - Regenerating birthday calendars to use new icons and fix old birthday events without year
     - Repair step already executed
 - Fix broken values of calendar objects
    0 [----->----------------------] < 1 sec 121.0 MiB
 - Registering building of calendar search index as background job
     - Repair step already executed
 - Register building of social profile search index as background job
     - Repair step already executed
 - Registering background jobs to update cache for webcal calendars
     - Added 0 background jobs to update webcal calendars
 - Registering building of calendar reminder index as background job
     - Repair step already executed
 - Clean up orphan event and contact data
     - 0 events without a calendar have been cleaned up
     - 0 properties without an events have been cleaned up
     - 0 changes without a calendar have been cleaned up
     - 0 cached events without a calendar subscription have been cleaned up
     - 0 changes without a calendar subscription have been cleaned up
     - 0 contacts without an addressbook have been cleaned up
     - 0 properties without a contact have been cleaned up
     - 0 changes without an addressbook have been cleaned up
 - Remove activity entries of private events
     - Removed 0 activity entries
 - Clean up old calendar subscriptions from deleted users that were not cleaned-up
 3/3 [============================] 100% < 1 sec/< 1 sec 121.0 MiB
     - 0 calendar subscriptions without an user have been cleaned up
 - Remove invalid object properties
     - 0 invalid object properties removed.
 - Copy default images to the app data directory
     - Icon external.svg already exists
     - Icon external-dark.svg already exists
     - Icon settings.svg already exists
     - Icon settings-dark.svg already exists
 - Fix the share type of guest shares when migrating from ownCloud
 - Copy the share password into the dedicated column
 - Set existing shares as accepted
 - Convert multi accounts
     - ERROR: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'token_type' doesn't have a default value
 - Clean up meta table
 - Show a hint about the new editor to existing users
 - Set binary permissions
 - Update OAuth token expiration times
 - Polls - Drop orphaned tables
     - No orphaned tables found
 - Polls - Drop orphaned columns
     - No orphaned columns found
 - Polls - Create hashes for votes and options
     - Updated 0 option hashes
     - Updated 0 vote hashes
 - Polls - Delete duplicates and orphaned records
 - Polls - Create indices and foreign key constraints
     - Added oc_polls_polls['poll_id'] <- oc_polls_comments['id']
     - Added oc_polls_polls['poll_id'] <- oc_polls_log['id']
     - Added oc_polls_polls['poll_id'] <- oc_polls_notif['id']
     - Added oc_polls_polls['poll_id'] <- oc_polls_options['id']
     - Added oc_polls_polls['poll_id'] <- oc_polls_share['id']
     - Added oc_polls_polls['poll_id'] <- oc_polls_votes['id']
     - Index UNIQ_options already exists in oc_polls_options
     - Index UNIQ_unprocessed already exists in oc_polls_log
     - Index UNIQ_subscription already exists in oc_polls_notif
     - Index UNIQ_shares already exists in oc_polls_share
     - Index UNIQ_votes already exists in oc_polls_votes
     - Index UNIQ_preferences already exists in oc_polls_preferences
     - Index UNIQ_watch already exists in oc_polls_watch
     - Index polls_polls_owners_non_deleted already exists in oc_polls_polls
     - Polls - Foreign key contraints created.
     - Polls - Indices created.
 - Force-reset all Text document sessions
 - Initialize migration of background images from dashboard to theming app
 - Add background job to check for backup codes
 - Repair provider registrations
 - Insert UUIDFix background job for user and group in batches
 - Remove deprecated refresh time markers for LDAP user records
 - Populating added database structures for workflows

The command runs through several more steps after the error and seems to finish "successfully". But afterwards the admin web interface still has the message about mimetype migrations. Running the command multiple times results in exactly the same command output. Maybe the one SQL error causes a rollback?

Steps to reproduce

  1. Uprade 28.0.8 to 28.0.9 (or 29.0.x to 29.0.5, see "Additional info")
  2. See the warning message about available mimetype migrations in admin web interface
  3. Execute occ maintenance:repair --include-expensive
  4. Tada: SQLSTATE ERROR and mimetype migrations still available

Expected behavior

No error in occ command and warning disappears from admin web interface.

Installation method

Community Docker image

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

MariaDB

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

Updated from a MINOR version (ex. 28.0.1 to 28.0.2)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "www.pimes.fh-dortmund.de",
            "owncloud.pimes.fh-dortmund.de",
            "owncloud.idial.institute",
            "nextcloud.vms.idial.fh",
            "nextcloud.idial.fh",
            "www.idial.cloud",
            "idial.cloud",
            "10.0.31.251",
            "web"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/owncloud.idial.institute",
        "htaccess.RewriteBase": "\/",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED_FOR",
            "HTTP_X_FORWARDED",
            "HTTP_FORWARDED_FOR"
        ],
        "allow_local_remote_servers": true,
        "dbtype": "mysql",
        "version": "28.0.9.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "logtimezone": "Europe\/Berlin",
        "loglevel": 3,
        "theme": "",
        "maintenance": false,
        "preview_libreoffice_path": "\/usr\/bin\/libreoffice",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 90",
        "activity_expire_days": 45,
        "lost_password_link": "https:\/\/iforgot.idial.institute\/?action=sendtoken",
        "updater.release.channel": "stable",
        "mysql.utf8mb4": true,
        "onlyoffice": {
            "verify_peer_off": true
        },
        "ldapUserCleanupInterval": "51",
        "mail_sendmailmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpdebug": false,
        "skeletondirectory": "",
        "data-fingerprint": "13a84e72f9554293f02fde789275c8eb",
        "activity_use_cached_mountpoints": true,
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "default_phone_region": "DE",
        "app_install_overwrite": [
            "groupfolders",
            "impersonate",
            "integration_moodle",
            "twofactor_admin"
        ],
        "auth.webauthn.enabled": false,
        "maintenance_window_start": 20,
        "defaultapp": "files",
        "user_oidc": {
            "auto_provision": false,
            "single_logout": true
        }
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - admin_audit: 1.18.0
  - analytics: 4.14.0
  - announcementcenter: 6.8.1
  - bookmarks: 14.2.4
  - calendar: 4.7.16
  - circles: 28.0.0
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contacts: 5.5.3
  - contactsinteraction: 1.9.0
  - dashboard: 7.8.0
  - dav: 1.29.2
  - deck: 1.12.4
  - external: 5.3.1
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_external: 1.20.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - firstrunwizard: 2.17.0
  - forms: 4.2.4
  - groupfolders: 16.0.8
  - impersonate: 1.15.0
  - integration_github: 2.0.7
  - integration_gitlab: 3.1.0
  - integration_jira: 1.2.0
  - integration_moodle: 1.0.2
  - integration_onedrive: 3.2.2
  - integration_openproject: 2.6.4
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - nextcloud_announcements: 1.17.0
  - notes: 4.10.1
  - notifications: 2.16.0
  - notify_push: 0.7.0
  - oauth2: 1.16.3
  - officeonline: 2.2.1
  - photos: 2.4.0
  - polls: 7.2.1
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.1
  - sharebymail: 1.18.0
  - side_menu: 3.13.1
  - systemtags: 1.18.0
  - tasks: 0.16.1
  - text: 3.9.2
  - theming: 2.3.0
  - twofactor_admin: 4.5.0
  - twofactor_backupcodes: 1.17.0
  - twofactor_email: 2.7.4
  - twofactor_nextcloud_notification: 3.10.0
  - twofactor_totp: 10.0.0-beta.2
  - twofactor_webauthn: 1.4.0
  - user_ldap: 1.19.0
  - user_oidc: 6.0.1
  - user_status: 1.8.1
  - viewer: 2.2.0
  - weather_status: 1.8.0
  - workflowengine: 2.10.0
Disabled:
  - bruteforcesettings: 2.8.0 (installed 1.3.0)
  - encryption: 2.16.0 (installed 2.8.1)
  - password_policy: 1.18.0 (installed 1.10.1)
  - support: 1.11.1 (installed 1.3.0)
  - survey_client: 1.16.0 (installed 1.8.0)
  - suspicious_login: 6.0.0
  - twofactor_reminder: 1.1.0 (installed 1.1.0)
  - updatenotification: 1.18.0 (installed 1.16.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"tHvpbcx7ju2vRlfGba88","level":3,"time":"2024-08-26T09:43:51+02:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Exception while executing repair step Convert multi accounts","userAgent":"--","version":"28.0.9.1","exception":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'token_type' doesn't have a default value","Code":1364,"Trace":[{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":328,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::","args":[["Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException"]]},{"file":"/var/www/html/lib/public/AppFramework/Db/QBMapper.php","line":137,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/custom_apps/integration_gitlab/lib/Migration/MultiAccountRepairStep.php","line":44,"function":"insert","class":"OCP\\AppFramework\\Db\\QBMapper","type":"->","args":[["OCA\\Gitlab\\Db\\GitlabAccount",null]]},{"file":"/var/www/html/lib/private/Repair.php","line":129,"function":"run","class":"OCA\\Gitlab\\Migration\\MultiAccountRepairStep","type":"->","args":[["OC\\Repair"]]},{"file":"/var/www/html/core/Command/Maintenance/Repair.php","line":120,"function":"run","class":"OC\\Repair","type":"->","args":[]},{"file":"/var/www/html/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Maintenance\\Repair","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Maintenance\\Repair"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/var/www/html/occ","line":11,"args":["/var/www/html/console.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/DB/Exceptions/DbalException.php","Line":71,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'token_type' doesn't have a default value","Code":1364,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1938,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->","args":[["Doctrine\\DBAL\\Driver\\PDO\\Exception"],["Doctrine\\DBAL\\Query"]]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1880,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->","args":[["Doctrine\\DBAL\\Driver\\PDO\\Exception"],["Doctrine\\DBAL\\Query"]]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1208,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":[["Doctrine\\DBAL\\Driver\\PDO\\Exception"],"INSERT INTO `oc_gitlab_accounts` (`user_id`, `url`, `token`, `user_info_name`, `user_info_display_name`) VALUES(?, ?, ?, ?, ?)",["kevin.koellmann","https://gitlab.idial.institute","cc086419ded93c81174a8013a285266f2b61d1af65a361999ddf19948423383f","kevin.koellmann",""],[2,2,2,2,2]]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":307,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->","args":["INSERT INTO `oc_gitlab_accounts` (`user_id`, `url`, `token`, `user_info_name`, `user_info_display_name`) VALUES(?, ?, ?, ?, ?)",["kevin.koellmann","https://gitlab.idial.institute","cc086419ded93c81174a8013a285266f2b61d1af65a361999ddf19948423383f","kevin.koellmann",""],[2,2,2,2,2]]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":386,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->","args":["INSERT INTO `oc_gitlab_accounts` (`user_id`, `url`, `token`, `user_info_name`, `user_info_display_name`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4, :dcValue5)",["kevin.koellmann","https://gitlab.idial.institute","cc086419ded93c81174a8013a285266f2b61d1af65a361999ddf19948423383f","kevin.koellmann",""],[2,2,2,2,2]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":326,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/public/AppFramework/Db/QBMapper.php","line":137,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/custom_apps/integration_gitlab/lib/Migration/MultiAccountRepairStep.php","line":44,"function":"insert","class":"OCP\\AppFramework\\Db\\QBMapper","type":"->","args":[["OCA\\Gitlab\\Db\\GitlabAccount",null]]},{"file":"/var/www/html/lib/private/Repair.php","line":129,"function":"run","class":"OCA\\Gitlab\\Migration\\MultiAccountRepairStep","type":"->","args":[["OC\\Repair"]]},{"file":"/var/www/html/core/Command/Maintenance/Repair.php","line":120,"function":"run","class":"OC\\Repair","type":"->","args":[]},{"file":"/var/www/html/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Maintenance\\Repair","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Maintenance\\Repair"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/var/www/html/occ","line":11,"args":["/var/www/html/console.php"],"function":"require_once"}],"File":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":114,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[HY000]: General error: 1364 Field 'token_type' doesn't have a default value","Code":1364,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":132,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::","args":[["PDOException",["HY000",1364,"Field 'token_type' doesn't have a default value"]]]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1202,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->","args":[]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":307,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->","args":["INSERT INTO `oc_gitlab_accounts` (`user_id`, `url`, `token`, `user_info_name`, `user_info_display_name`) VALUES(?, ?, ?, ?, ?)",["kevin.koellmann","https://gitlab.idial.institute","cc086419ded93c81174a8013a285266f2b61d1af65a361999ddf19948423383f","kevin.koellmann",""],[2,2,2,2,2]]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":386,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->","args":["INSERT INTO `oc_gitlab_accounts` (`user_id`, `url`, `token`, `user_info_name`, `user_info_display_name`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4, :dcValue5)",["kevin.koellmann","https://gitlab.idial.institute","cc086419ded93c81174a8013a285266f2b61d1af65a361999ddf19948423383f","kevin.koellmann",""],[2,2,2,2,2]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":326,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/public/AppFramework/Db/QBMapper.php","line":137,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/custom_apps/integration_gitlab/lib/Migration/MultiAccountRepairStep.php","line":44,"function":"insert","class":"OCP\\AppFramework\\Db\\QBMapper","type":"->","args":[["OCA\\Gitlab\\Db\\GitlabAccount",null]]},{"file":"/var/www/html/lib/private/Repair.php","line":129,"function":"run","class":"OCA\\Gitlab\\Migration\\MultiAccountRepairStep","type":"->","args":[["OC\\Repair"]]},{"file":"/var/www/html/core/Command/Maintenance/Repair.php","line":120,"function":"run","class":"OC\\Repair","type":"->","args":[]},{"file":"/var/www/html/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Maintenance\\Repair","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Maintenance\\Repair"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/var/www/html/occ","line":11,"args":["/var/www/html/console.php"],"function":"require_once"}],"File":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":28,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 1364 Field 'token_type' doesn't have a default value","Code":"HY000","Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":130,"function":"execute","class":"PDOStatement","type":"->","args":[null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1202,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->","args":[]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":307,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->","args":["INSERT INTO `oc_gitlab_accounts` (`user_id`, `url`, `token`, `user_info_name`, `user_info_display_name`) VALUES(?, ?, ?, ?, ?)",["kevin.koellmann","https://gitlab.idial.institute","cc086419ded93c81174a8013a285266f2b61d1af65a361999ddf19948423383f","kevin.koellmann",""],[2,2,2,2,2]]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":386,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->","args":["INSERT INTO `oc_gitlab_accounts` (`user_id`, `url`, `token`, `user_info_name`, `user_info_display_name`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4, :dcValue5)",["kevin.koellmann","https://gitlab.idial.institute","cc086419ded93c81174a8013a285266f2b61d1af65a361999ddf19948423383f","kevin.koellmann",""],[2,2,2,2,2]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":326,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/public/AppFramework/Db/QBMapper.php","line":137,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/custom_apps/integration_gitlab/lib/Migration/MultiAccountRepairStep.php","line":44,"function":"insert","class":"OCP\\AppFramework\\Db\\QBMapper","type":"->","args":[["OCA\\Gitlab\\Db\\GitlabAccount",null]]},{"file":"/var/www/html/lib/private/Repair.php","line":129,"function":"run","class":"OCA\\Gitlab\\Migration\\MultiAccountRepairStep","type":"->","args":[["OC\\Repair"]]},{"file":"/var/www/html/core/Command/Maintenance/Repair.php","line":120,"function":"run","class":"OC\\Repair","type":"->","args":[]},{"file":"/var/www/html/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Maintenance\\Repair","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Maintenance\\Repair"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/var/www/html/occ","line":11,"args":["/var/www/html/console.php"],"function":"require_once"}],"File":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":130}}},"message":"Exception while executing repair step Convert multi accounts","exception":{},"CustomMessage":"Exception while executing repair step Convert multi accounts"}}

Additional info

The problem is already described in the Nextcloud Forums from a user running 29.0.5: https://help.nextcloud.com/t/error-field-token-type-doesnt-have-a-default-value-after-nc-29-0-5-upgrade/201410/3

koelle25 commented 2 weeks ago

Can some maintainer please immediately remove and block the spam/scam messages above? @rullzer @nickvergessen @juliushaertl ?

Edit: I have also reported the file to Mediafire Abuse Team (abuse@mediafire.com).

nickvergessen commented 2 weeks ago

@koelle25 it's best to use the "Report spam" button on such messages, so GitHub blocks the complete accounts.

koelle25 commented 2 weeks ago

Thanks @nickvergessen. Unfortunately this button seems to be missing for me: grafik

nickvergessen commented 2 weeks ago

grafik

Seems I used it too often, was able to report 2

nickvergessen commented 2 weeks ago

Thanks for the help then!

solracsf commented 2 weeks ago

But afterwards the admin web interface still has the message about mimetype migrations.

This part is already fixed by https://github.com/nextcloud/server/issues/47359

joshtrichards commented 2 weeks ago
 - Convert multi accounts
    - ERROR: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'token_type' doesn't have a default value

This isn't coming from server. Looks like it may be part of a migration in the integration_gitlab app:

https://github.com/nextcloud/integration_gitlab/blob/7968978c861ed4e48911d8d41e5c46d29a4fc6dd/lib/Migration/MultiAccountRepairStep.php#L23

So, in conclusion: the mimetype stuff stuff is unrelated (and fixed; pending release in the next maintenance release - see nextcloud/server#47359).

I'll move this over to the repo for that app.

kyteinsky commented 2 weeks ago

Hello @koelle25, did you run occ upgrade before running the maintenance repair? What does occ migrations:status integration_gitlab show?

koelle25 commented 2 weeks ago

Hello @kyteinsky, unfortunately this command does not seem to exist: grafik

Here is a list of available commands, I couldn't find anything similar to your suggestion: ``` Available commands: check check dependencies of the server environment completion Dump the shell completion script help Display help for a command list List commands setupchecks Run setup checks and output the results status show some status information upgrade run upgrade routines after installation of a new release. The release has to be installed before. activity activity:send-mails Sends the activity notification mails admin-delegation admin-delegation:add add setting delegation to a group admin-delegation:remove remove settings delegation from a group admin-delegation:show show delegated settings analytics analytics:load execute a dataload app app:disable disable an app app:enable enable an app app:getpath Get an absolute path to the app directory app:install install an app app:list List all available apps app:remove remove an app app:update update an app or all apps background background:ajax Use ajax to run background jobs background:cron Use cron to run background jobs background:webcron Use webcron to run background jobs background-job background-job:delete Remove a background job from database background-job:execute Execute a single background job manually background-job:list List background jobs bookmarks bookmarks:clear-previews Clear all cached bookmarks previews so that they have to be regenerated broadcast broadcast:test test the SSE broadcaster circles circles:check Checking your configuration circles:maintenance Clean stuff, keeps the app running circles:manage:config edit config/type of a Circle circles:manage:create create a new circle circles:manage:destroy destroy a circle by its ID circles:manage:details get details about a circle by its ID circles:manage:edit edit displayName or description of a Circle circles:manage:join emulate a user joining a Circle circles:manage:leave simulate a user joining a Circle circles:manage:list listing current circles circles:manage:setting edit setting for a Circle circles:members:add Add a member to a Circle circles:members:details get details about a member by its ID circles:members:level Change the level of a member from a Circle circles:members:list listing Members from a Circle circles:members:remove remove a member from a circle circles:members:search Change the level of a member from a Circle circles:memberships index and display memberships for local and federated users circles:remote remote features circles:shares:files listing shares files circles:sync Sync Circles and Members circles:test testing some features config config:app:delete Delete an app config value config:app:get Get an app config value config:app:set Set an app config value config:import Import a list of configs config:list List all configs config:system:delete Delete a system config value config:system:get Get a system config value config:system:set Set a system config value dav dav:create-addressbook Create a dav addressbook dav:create-calendar Create a dav calendar dav:delete-calendar Delete a dav calendar dav:fix-missing-caldav-changes Insert missing calendarchanges rows for existing events dav:list-calendars List all calendars of a user dav:move-calendar Move a calendar from an user to another dav:remove-invalid-shares Remove invalid dav shares dav:retention:clean-up dav:send-event-reminders Sends event reminders dav:sync-birthday-calendar Synchronizes the birthday calendar dav:sync-system-addressbook Synchronizes users to the system addressbook db db:add-missing-columns Add missing optional columns to the database tables db:add-missing-indices Add missing indices to the database tables db:add-missing-primary-keys Add missing primary keys to the database tables db:convert-filecache-bigint Convert the ID columns of the filecache to BigInt db:convert-mysql-charset Convert charset of MySQL/MariaDB to use utf8mb4 db:convert-type Convert the Nextcloud database to the newly configured one deck deck:export Export a JSON dump of user data deck:import Import data deck:transfer-ownership Change owner of deck boards encryption encryption:change-key-storage-root Change key storage root encryption:decrypt-all Disable server-side encryption and decrypt all files encryption:disable Disable encryption encryption:enable Enable encryption encryption:encrypt-all Encrypt all files for all users encryption:list-modules List all available encryption modules encryption:migrate-key-storage-format Migrate the format of the keystorage to a newer format encryption:set-default-module Set the encryption default module encryption:show-key-storage-root Show current key storage root encryption:status Lists the current status of encryption federation federation:sync-addressbooks Synchronizes addressbooks of all federated clouds files files:cleanup cleanup filecache files:copy Copy a file or folder files:delete Delete a file or folder files:get Get the contents of a file files:move Move a file or folder files:object:delete Delete an object from the object store files:object:get Get the contents of an object files:object:put Write a file to the object store files:put Write contents of a file files:recommendations:recommend files:reminders List file reminders files:repair-tree Try and repair malformed filesystem tree structures files:scan rescan filesystem files:scan-app-data rescan the AppData folder files:transfer-ownership All files and folders are moved to another user - outgoing shares and incoming user file shares (optionally) are moved as well. files_external files_external:applicable Manage applicable users and groups for a mount files_external:backends Show available authentication and storage backends files_external:config Manage backend configuration for a mount files_external:create Create a new mount configuration files_external:delete Delete an external mount files_external:export Export mount configurations files_external:import Import mount configurations files_external:list List configured admin or personal mounts files_external:notify Listen for active update notifications for a configured external mount files_external:option Manage mount options for a mount files_external:scan Scan an external storage for changed files files_external:verify Verify mount configuration group group:add Add a group group:adduser add a user to a group group:delete Remove a group group:info Show information about a group group:list list configured groups group:removeuser remove a user from a group groupfolders groupfolders:create Create a new group folder groupfolders:delete Delete group folder groupfolders:expire Trigger expiry of versions and trashbin for files stored in group folders groupfolders:group Edit the groups that have access to a group folder groupfolders:list List the configured group folders groupfolders:permissions Configure advanced permissions for a configured group folder groupfolders:quota Edit the quota of a configured group folder groupfolders:rename Rename group folder groupfolders:scan Scan a group folder for outside changes groupfolders:trashbin:cleanup Empty the groupfolder trashbin info info:file get information for a file info:file:space Summarize space usage of specified folder integrity integrity:check-app Check integrity of an app using a signature. integrity:check-core Check integrity of core code using a signature. integrity:sign-app Signs an app using a private key. integrity:sign-core Sign core using a private key. l10n l10n:createjs Create javascript translation files for a given app ldap ldap:check-group checks whether a group exists on LDAP. ldap:check-user checks whether a user exists on LDAP. ldap:create-empty-config creates an empty LDAP configuration ldap:delete-config deletes an existing LDAP configuration ldap:promote-group declares the specified group as admin group (only one is possible per LDAP configuration) ldap:reset-group deletes an LDAP group independent of the group state in the LDAP ldap:reset-user deletes an LDAP user independent of the user state ldap:search executes a user or group search ldap:set-config modifies an LDAP configuration ldap:show-config shows the LDAP configuration ldap:show-remnants shows which users are not available on LDAP anymore, but have remnants in Nextcloud. ldap:test-config tests an LDAP configuration ldap:update-uuid Attempts to update UUIDs of user and group entries. By default, the command attempts to update UUIDs that have been invalidated by a migration step. log log:file manipulate logging backend log:manage manage logging configuration log:tail Tail the nextcloud logfile log:watch Watch the nextcloud logfile maintenance maintenance:data-fingerprint update the systems data-fingerprint after a backup is restored maintenance:mimetype:update-db Update database mimetypes and update filecache maintenance:mimetype:update-js Update mimetypelist.js maintenance:mode set maintenance mode maintenance:repair repair this installation maintenance:repair-share-owner repair invalid share-owner entries in the database maintenance:theme:update Apply custom theme changes maintenance:update:htaccess Updates the .htaccess file metadata metadata:get get stored metadata about a file, by its id migrations migrations:preview Get preview of available DB migrations in case of initiating an upgrade notification notification:generate Generate a notification for the given user notification:test-push Generate a notification for the given user notify_push notify_push:log Temporarily set the log level of the push server notify_push:metrics Get the metrics from the push server notify_push:reset Cancel all active connections to the push server notify_push:self-test Run self test for configured push server notify_push:setup Configure push server photos photos:albums:add Add specified photo to album photos:albums:create Create a new album for a user photos:update-1000-cities Update the list of 1000 and more inhabitant cities polls polls:db:clean-migrations Remove old migrations entries from Nextcloud's migration table polls:db:purge Remove all polls related tables and records polls:db:rebuild Rebuilds poll's table structure polls:db:reset-watch Resets the Watch table polls:index:create Add all indices and foreign key constraints polls:index:remove Remove all indices and foreign key constraints polls:poll:transfer-ownership Transfer the ownership of one user's polls to another user. polls:share:add Invites users to a poll polls:share:remove Remove user invitations from a poll preview preview:generate generate a preview for a file preview:repair distributes the existing previews into subfolders preview:reset-rendered-texts Deletes all generated avatars and previews of text and md files security security:bruteforce:attempts Show bruteforce attempts status for a given IP address security:bruteforce:reset resets bruteforce attempts for given IP address security:certificates list trusted certificates security:certificates:import import trusted certificate in PEM format security:certificates:remove remove trusted certificate serverinfo serverinfo:update-storage-statistics Triggers an update of the counts related to storages used in serverinfo sharing sharing:cleanup-remote-storages Cleanup shared storage entries that have no matching entry in the shares_external table sharing:delete-orphan-shares Delete shares where the owner no longer has access to the file sharing:expiration-notification Notify share initiators when a share will expire the next day. tag tag:add Add new tag tag:delete delete a tag tag:edit edit tag attributes tag:list list tags text text:reset Reset a text document session to the current file content theming theming:config Set theming app config values trashbin trashbin:cleanup Remove deleted files trashbin:expire Expires the users trashbin trashbin:restore Restore all deleted files according to the given filters trashbin:size Configure the target trashbin size twofactor_totp twofactor_totp:cleanup Remove orphaned totp secrets twofactor_webauthn twofactor_webauthn:cleanup Remove orphaned webauthn credentials twofactor_webauthn:migrate-u2f twofactorauth twofactorauth:admin:generate-code Generate a one-time 2FA code for users to log into their account twofactorauth:cleanup Clean up the two-factor user-provider association of an uninstalled/removed provider twofactorauth:disable Disable two-factor authentication for a user twofactorauth:enable Enable two-factor authentication for a user twofactorauth:enforce Enabled/disable enforced two-factor authentication twofactorauth:state Get the two-factor authentication (2FA) state of a user user user:add adds an account user:auth-tokens:add [user:add-app-password] Add app password for the named account user:auth-tokens:delete Deletes an authentication token user:auth-tokens:list List authentication tokens of an user user:delete deletes the specified user user:disable disables the specified user user:enable enables the specified user user:info show user info user:keys:verify Verify if the stored public key matches the stored private key user:lastseen shows when the user was logged in last time user:list list configured users user:report shows how many users have access user:resetpassword Resets the password of the named user user:setting Read and modify user settings user:sync-account-data sync user backend data to accounts table for configured users user_oidc user_oidc:provider Create, show or update a OpenId connect provider config given the identifier of a provider user_oidc:provider:delete Delete an OpenId connect provider versions versions:cleanup Delete versions versions:expire Expires the users file versions workflows workflows:list Lists configured workflows ```

occ upgrade only outputs "Nextcloud is already latest version".

kyteinsky commented 2 weeks ago

Sorry it's a debug command, which means the instance needs to be in debug mode, i.e. 'debug' => true set in config.php. If you don't want to do that, can you try a reinstall of the integration_gitlab app?

koelle25 commented 2 weeks ago

Oh okay, thanks for the clarification.

I just did a reinstall of the app, but the SQLSTATE error still appears.

The output of occ migrations:status integration_gitlab in debug mode is:

>> App:                                                integration_gitlab
>> Version Table Name:                                 oc_migrations
>> Migrations Namespace:                               OCA\Gitlab\Migration
>> Migrations Directory:                               /var/www/html/custom_apps/integration_gitlab/lib/Migration
>> Previous Version:                                   0
>> Current Version:                                    3000Date20240718103726
>> Next Version:                                       Already at latest migration step
>> Latest Version:                                     3000Date20240718103726
>> Executed Migrations:                                1
>> Executed Unavailable Migrations:                    1
>> Available Migrations:                               1
>> New Migrations:                                     1
>> Pending Migrations:                                 None
kyteinsky commented 2 weeks ago

@provokateurin Can you help us out here?

provokateurin commented 2 weeks ago

It seems like there was no token type stored in the user config in the first place. This is an invalid state already, it just was never discovered. I think you can fix the migration by inferring the token type by checking if a refresh token exists. If it is there then it is oauth, otherwise personal. @kyteinsky does that make sense to you?

kyteinsky commented 2 weeks ago

Yes, thanks. Check the PR if it looks good.

kyteinsky commented 2 weeks ago

Hi @koelle25, can you apply this patch (https://patch-diff.githubusercontent.com/raw/nextcloud/integration_gitlab/pull/98.diff) and check if it works using occ maintenance:repair ?

koelle25 commented 2 weeks ago

Yes, the patched file works! No error anymore:

$ occ maintenance:repair
[...]
 - Set existing shares as accepted
 - Convert multi accounts
 - Clean up meta table
[...]

Thanks for fixing so quickly!

kyteinsky commented 2 weeks ago

Happy to hear that! Thanks to Kate for the concise explanation too!