Unknown column 'lazy' in 'field list' when upgrading from 28.0.1.1 to 29.0.3.4

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 29.0.5): 28.0.1.1, upgrading to 29.0.3.4
Operating system and version (eg, Ubuntu 29.04): "latest" Docker Image
Apache or nginx version (eg, Apache 2.4.25): "latest" Docker Image
PHP version (eg, 8.3): "latest" Docker Image

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. run occ upgrade

The output of your Nextcloud log in Admin > Logging:

I can't access the WEB UI (server in maintenance mode), this is from the console:

occ -vvvvvvvv upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
2024-06-26T20:11:01+00:00 Setting log level to debug
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 In DbalException.php line 71:
2024-06-26T20:11:01+00:00                                                                                                                                 
2024-06-26T20:11:01+00:00   [OC\DB\Exceptions\DbalException (1054)]                                                                                       
2024-06-26T20:11:01+00:00   An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lazy' in 'field list'  
2024-06-26T20:11:01+00:00                                                                                                                                 
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 Exception trace:
2024-06-26T20:11:01+00:00   at /app/www/public/lib/private/DB/Exceptions/DbalException.php:71
2024-06-26T20:11:01+00:00  OC\DB\Exceptions\DbalException::wrap() at /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php:328
2024-06-26T20:11:01+00:00  OC\DB\QueryBuilder\QueryBuilder->executeStatement() at /app/www/public/lib/private/AppConfig.php:783
2024-06-26T20:11:01+00:00  OC\AppConfig->setTypedValue() at /app/www/public/lib/private/AppConfig.php:1360
2024-06-26T20:11:01+00:00  OC\AppConfig->setValue() at /app/www/public/lib/private/AllConfig.php:208
2024-06-26T20:11:01+00:00  OC\AllConfig->setAppValue() at /app/www/public/lib/private/Updater.php:126
2024-06-26T20:11:01+00:00  OC\Updater->upgrade() at /app/www/public/core/Command/Upgrade.php:216
2024-06-26T20:11:01+00:00  OC\Core\Command\Upgrade->execute() at /app/www/public/3rdparty/symfony/console/Command/Command.php:298
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Command\Command->run() at /app/www/public/3rdparty/symfony/console/Application.php:1040
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->doRunCommand() at /app/www/public/3rdparty/symfony/console/Application.php:301
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->doRun() at /app/www/public/3rdparty/symfony/console/Application.php:171
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->run() at /app/www/public/lib/private/Console/Application.php:213
2024-06-26T20:11:01+00:00  OC\Console\Application->run() at /app/www/public/console.php:102
2024-06-26T20:11:01+00:00  require_once() at /app/www/public/occ:11
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 In ExceptionConverter.php line 67:
2024-06-26T20:11:01+00:00                                                                                                                                 
2024-06-26T20:11:01+00:00   [Doctrine\DBAL\Exception\InvalidFieldNameException (1054)]                                                                    
2024-06-26T20:11:01+00:00   An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lazy' in 'field list'  
2024-06-26T20:11:01+00:00                                                                                                                                 
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 Exception trace:
2024-06-26T20:11:01+00:00   at /app/www/public/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:67
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert() at /app/www/public/3rdparty/doctrine/dbal/src/Connection.php:1943
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Connection->handleDriverException() at /app/www/public/3rdparty/doctrine/dbal/src/Connection.php:1885
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Connection->convertExceptionDuringQuery() at /app/www/public/3rdparty/doctrine/dbal/src/Connection.php:1213
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Connection->executeStatement() at /app/www/public/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php:292
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Connections\PrimaryReadReplicaConnection->executeStatement() at /app/www/public/lib/private/DB/Connection.php:373
2024-06-26T20:11:01+00:00  OC\DB\Connection->executeStatement() at /app/www/public/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php:393
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Query\QueryBuilder->execute() at /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php:280
2024-06-26T20:11:01+00:00  OC\DB\QueryBuilder\QueryBuilder->execute() at /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php:326
2024-06-26T20:11:01+00:00  OC\DB\QueryBuilder\QueryBuilder->executeStatement() at /app/www/public/lib/private/AppConfig.php:783
2024-06-26T20:11:01+00:00  OC\AppConfig->setTypedValue() at /app/www/public/lib/private/AppConfig.php:1360
2024-06-26T20:11:01+00:00  OC\AppConfig->setValue() at /app/www/public/lib/private/AllConfig.php:208
2024-06-26T20:11:01+00:00  OC\AllConfig->setAppValue() at /app/www/public/lib/private/Updater.php:126
2024-06-26T20:11:01+00:00  OC\Updater->upgrade() at /app/www/public/core/Command/Upgrade.php:216
2024-06-26T20:11:01+00:00  OC\Core\Command\Upgrade->execute() at /app/www/public/3rdparty/symfony/console/Command/Command.php:298
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Command\Command->run() at /app/www/public/3rdparty/symfony/console/Application.php:1040
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->doRunCommand() at /app/www/public/3rdparty/symfony/console/Application.php:301
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->doRun() at /app/www/public/3rdparty/symfony/console/Application.php:171
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->run() at /app/www/public/lib/private/Console/Application.php:213
2024-06-26T20:11:01+00:00  OC\Console\Application->run() at /app/www/public/console.php:102
2024-06-26T20:11:01+00:00  require_once() at /app/www/public/occ:11
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 In Exception.php line 28:
2024-06-26T20:11:01+00:00                                                                                  
2024-06-26T20:11:01+00:00   [Doctrine\DBAL\Driver\PDO\Exception (1054)]                                    
2024-06-26T20:11:01+00:00   SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lazy' in 'field list'  
2024-06-26T20:11:01+00:00                                                                                  
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 Exception trace:
2024-06-26T20:11:01+00:00   at /app/www/public/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php:28
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Driver\PDO\Exception::new() at /app/www/public/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:132
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Driver\PDO\Statement->execute() at /app/www/public/3rdparty/doctrine/dbal/src/Connection.php:1207
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Connection->executeStatement() at /app/www/public/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php:292
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Connections\PrimaryReadReplicaConnection->executeStatement() at /app/www/public/lib/private/DB/Connection.php:373
2024-06-26T20:11:01+00:00  OC\DB\Connection->executeStatement() at /app/www/public/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php:393
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Query\QueryBuilder->execute() at /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php:280
2024-06-26T20:11:01+00:00  OC\DB\QueryBuilder\QueryBuilder->execute() at /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php:326
2024-06-26T20:11:01+00:00  OC\DB\QueryBuilder\QueryBuilder->executeStatement() at /app/www/public/lib/private/AppConfig.php:783
2024-06-26T20:11:01+00:00  OC\AppConfig->setTypedValue() at /app/www/public/lib/private/AppConfig.php:1360
2024-06-26T20:11:01+00:00  OC\AppConfig->setValue() at /app/www/public/lib/private/AllConfig.php:208
2024-06-26T20:11:01+00:00  OC\AllConfig->setAppValue() at /app/www/public/lib/private/Updater.php:126
2024-06-26T20:11:01+00:00  OC\Updater->upgrade() at /app/www/public/core/Command/Upgrade.php:216
2024-06-26T20:11:01+00:00  OC\Core\Command\Upgrade->execute() at /app/www/public/3rdparty/symfony/console/Command/Command.php:298
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Command\Command->run() at /app/www/public/3rdparty/symfony/console/Application.php:1040
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->doRunCommand() at /app/www/public/3rdparty/symfony/console/Application.php:301
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->doRun() at /app/www/public/3rdparty/symfony/console/Application.php:171
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->run() at /app/www/public/lib/private/Console/Application.php:213
2024-06-26T20:11:01+00:00  OC\Console\Application->run() at /app/www/public/console.php:102
2024-06-26T20:11:01+00:00  require_once() at /app/www/public/occ:11
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 In Statement.php line 130:
2024-06-26T20:11:01+00:00                                                                                  
2024-06-26T20:11:01+00:00   [PDOException (42S22)]                                                         
2024-06-26T20:11:01+00:00   SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lazy' in 'field list'  
2024-06-26T20:11:01+00:00                                                                                  
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 Exception trace:
2024-06-26T20:11:01+00:00   at /app/www/public/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:130
2024-06-26T20:11:01+00:00  PDOStatement->execute() at /app/www/public/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:130
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Driver\PDO\Statement->execute() at /app/www/public/3rdparty/doctrine/dbal/src/Connection.php:1207
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Connection->executeStatement() at /app/www/public/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php:292
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Connections\PrimaryReadReplicaConnection->executeStatement() at /app/www/public/lib/private/DB/Connection.php:373
2024-06-26T20:11:01+00:00  OC\DB\Connection->executeStatement() at /app/www/public/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php:393
2024-06-26T20:11:01+00:00  Doctrine\DBAL\Query\QueryBuilder->execute() at /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php:280
2024-06-26T20:11:01+00:00  OC\DB\QueryBuilder\QueryBuilder->execute() at /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php:326
2024-06-26T20:11:01+00:00  OC\DB\QueryBuilder\QueryBuilder->executeStatement() at /app/www/public/lib/private/AppConfig.php:783
2024-06-26T20:11:01+00:00  OC\AppConfig->setTypedValue() at /app/www/public/lib/private/AppConfig.php:1360
2024-06-26T20:11:01+00:00  OC\AppConfig->setValue() at /app/www/public/lib/private/AllConfig.php:208
2024-06-26T20:11:01+00:00  OC\AllConfig->setAppValue() at /app/www/public/lib/private/Updater.php:126
2024-06-26T20:11:01+00:00  OC\Updater->upgrade() at /app/www/public/core/Command/Upgrade.php:216
2024-06-26T20:11:01+00:00  OC\Core\Command\Upgrade->execute() at /app/www/public/3rdparty/symfony/console/Command/Command.php:298
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Command\Command->run() at /app/www/public/3rdparty/symfony/console/Application.php:1040
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->doRunCommand() at /app/www/public/3rdparty/symfony/console/Application.php:301
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->doRun() at /app/www/public/3rdparty/symfony/console/Application.php:171
2024-06-26T20:11:01+00:00  Symfony\Component\Console\Application->run() at /app/www/public/lib/private/Console/Application.php:213
2024-06-26T20:11:01+00:00  OC\Console\Application->run() at /app/www/public/console.php:102
2024-06-26T20:11:01+00:00  require_once() at /app/www/public/occ:11
2024-06-26T20:11:01+00:00 
2024-06-26T20:11:01+00:00 upgrade
2024-06-26T20:11:01+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

cat /config/www/nextcloud/config/config.php 
<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => 'mysecret',
  'passwordsalt' => 'mysecret',
  'secret' => 'mysecret',
  'trusted_domains' => 
  array (
    0 => '10.200.115.174:6443',
    1 => 'mysecret.domain',
  ),
  'dbtype' => 'mysql',
  'version' => '28.0.1.1',
  'overwrite.cli.url' => 'https://10.200.115.174:6443',
  'dbname' => 'nextcloud',
  'dbhost' => '10.200.115.174:3307',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'mysecret',
  'installed' => true,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
    0 => 'admin',
  ),
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'mysecret.domain',
  'theme' => '',
  'loglevel' => 0,
  'maintenance' => true,
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\APCu',
  'upgrade.disable-web' => false,
);

The output of your Apache/nginx/system log in /var/log/____:

2024/06/26 16:05:16 [warn] 571#571: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /config/nginx/site-confs/default.conf:13
2024/06/26 16:05:16 [warn] 571#571: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /config/nginx/site-confs/default.conf:14

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

cat nextcloud.log
{"reqId":"mLVjfxAdoUZDyRdRtfel","level":1,"time":"2024-06-26T20:25:54+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::setDebugLogLevel: Set log level to debug","userAgent":"--","version":"28.0.1.1","data":{"app":"updater"}}

What image are you using? It’s unusual to run occ upgrade against a Docker image unless you’re already having problems.

How, precisely, did you update your container from 28.0.1 to 29.0.3?

From the looks of it you’re not using any of the Nextcloud provided images, but perhaps the LinuxServer.io maintained one?

In general I would not make such large jumps in between versions. You are far more likely to encounter problems.

Officially you’re supposed to upgrade to the latest maintenance release in your major version before jumping to the next major version.

I’m still using NC 28.0.7 and had a quick look in which table the lazy field exists. This is my finding:

> describe oc_appconfig;
+-------------+-------------+------+-----+---------+-------+
| Field       | Type        | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| appid       | varchar(32) | NO   | PRI |         |       |
| configkey   | varchar(64) | NO   | PRI |         |       |
| configvalue | longtext    | YES  |     | NULL    |       |
| type        | int(11)     | NO   |     | 2       |       |
| lazy        | tinyint(1)  | YES  |     | 0       |       |
+-------------+-------------+------+-----+---------+-------+
5 rows in set (0.001 sec)

Unfortunately I don’t know if this field is being removed in future NC versions.

I just got the same error while upgrading using the Docker image from https://hub.docker.com/_/nextcloud with the tag nextcloud:apache.
When I go to the Nextcloud URL, I agree to update the database and then it tells me :

OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lazy' in 'field list'

Looking at the databases:

MariaDB [nextcloud]> describe oc_appconfig;
+-------------+-------------+------+-----+---------+-------+
| Field       | Type        | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| appid       | varchar(32) | NO   | PRI |         |       |
| configkey   | varchar(64) | NO   | PRI |         |       |
| configvalue | longtext    | YES  |     | NULL    |       |
+-------------+-------------+------+-----+---------+-------+
3 rows in set (0.002 sec)

Due to the fact that a missing index has been addressed last week in the following ticket, I assume that the field is still required:

Have you tried to add the missing field manually to get rid of the error message?
Nevertheless it might be worth to open an issue ticket in the Github repository to get it fixed in the docker image:

I went back to the latest 28.x release and it installed w/o issue. After that, the latest 29.x release installed with no problems. Next time I won’t try to take shortcuts :slight_smile:

3 Likes

Do you know what version you upgraded from? I would suggest tagging your Docker image reference with a version string so that you don’t get unpredictable version bumps.

Running into the same issue when trying to upgrade from 28.0.1 to 29.0.3 unfortunately. So far I haven’t been able to complete my upgrade and have my instance unavailable. Running my nextcloud instance with maradb in docker containers.

As noted by j-ed I “fixed” my upgrade issue by altering the oc_appconfig table and adding two missing columns by using these statements:

alter table oc_appconfig add lazy tinyint(1) null default 0;
alter table oc_appconfig add `type` int(11) not null default 2;
2 Likes

I am using Docker I have used this process

Step 1: Identify Your Database Container

First, you need to identify the name of your database container. Run the following command to list all running Docker containers:

docker ps

Look for your Nextcloud database container, typically named something like nextcloud-db or mysql.

Step 2: Access the Database Container

Use the docker exec command to access the shell of your database container. For example, if your container is named nextcloud-db:

docker exec -it nextcloud-db /bin/bash

Step 3: Access MySQL

Once inside the container, access the MySQL data

mysql -u your_username -p

You will be prompted for the password. Use the credentials you set when you configured the Nextcloud database.

Step 4: Select the Nextcloud Database

After logging into MySQL, select your Nextcloud database:

USE your_nextcloud_database;

Replace your_nextcloud_database with the actual name of your database.

i.e it can be found config.php under dbname and password is also found there

Step 5: Add the Missing Column

Identify the table where the column is missing and add it. For example, if the missing column is ‘lazy’ in a table named oc_appconfig:

alter table oc_appconfig add lazy tinyint(1) null default 0;

then

alter table oc_appconfig add `type` int(11) not null default 2;

Step 6: Verify the Changes

Verify that the column has been added correctly:

DESCRIBE oc_appconfig;

This command will show the structure of the table, including the new column.

After that i turned off the maintainance mode and manually started the upgrade proccess on the web page. At the end it showed one error but after reloading/refreshing the page it open to dashboard and thus the nextcloud is updated to 29.0.3.4.

1 Like

Thanks for being my guinea pig, saved my day!

  • updated from 28.0.1 to 29.0.3 and failed (was that lazy column added especially for people like me and you? :smiley: )
  • updated from 28.0.1 to 28.0.4 and then to 29.0.3 → still in maintenance mode but no migration errors
  • removed maintenance from config.php → all fine