Internal Server Error translation into human

Nextcloud version (eg, 12.0.2): trying to upgrade to 15.0.4… ish
Operating system and version (eg, Ubuntu 17.04): Linux
Apache or nginx version (eg, Apache 2.4.25): Apache/2.2.34 (Unix)
PHP version (eg, 7.1): PHP 7.0.33 (cli)

The issue you are facing:

Internal Server Error

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.

Technical details

  • Remote Address: 173.244.44.81
  • Request ID: XGu8-0XDfD0AC5IqWlEAAADG
  • Type: Doctrine\DBAL\Exception\InvalidFieldNameException
  • Code: 0
  • Message: An exception occurred while executing ‘SELECT * FROM oc_authtoken WHERE (token = ?) AND (version = ?)’ with params [“84593c6dd3e23d1bf7ce1e881bfb8d1cd54ef561696a6de6a7719dba41639d6a8b38d20f547c130dce0f0d59da1c314bc9f1d12ca418d5c978cf71e4c934b2b2”, 2]: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘version’ in ‘where clause’
  • File: /home2/boydhana/public_html/cloud.boydhanaleiako.me/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
  • Line: 71

Trace

#0 /home2/boydhana/public_html/cloud.boydhanaleiako.me/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(128): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException(‘An exception oc…’, Object(Doctrine\DBAL\Driver\PDOException)) #1 /home2/boydhana/public_html/cloud.boydhanaleiako.me/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(855): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), ‘SELECT * FROM ...', Array) #2 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/private/DB/Connection.php(195): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM …’, Array, Array, NULL) #3 /home2/boydhana/public_html/cloud.boydhanaleiako.me/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(206): OC\DB\Connection->executeQuery(‘SELECT * FROM `…’, Array, Array) #4 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/private/DB/QueryBuilder/QueryBuilder.php(214): Doctrine\DBAL\Query\QueryBuilder->execute() #5 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/private/Authentication/Token/PublicKeyTokenMapper.php(79): OC\DB\QueryBuilder\QueryBuilder->execute() #6 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/private/Authentication/Token/PublicKeyTokenProvider.php(79): OC\Authentication\Token\PublicKeyTokenMapper->getToken(‘84593c6dd3e23d1…’) #7 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/private/Authentication/Token/Manager.php(115): OC\Authentication\Token\PublicKeyTokenProvider->getToken(‘uapfkb5ba3htq2m…’) #8 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/private/User/Session.php(588): OC\Authentication\Token\Manager->getToken(‘uapfkb5ba3htq2m…’) #9 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/private/User/Session.php(780): OC\User\Session->loginWithToken(‘uapfkb5ba3htq2m…’) #10 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/base.php(1031): OC\User\Session->tryTokenLogin(Object(OC\AppFramework\Http\Request)) #11 /home2/boydhana/public_html/cloud.boydhanaleiako.me/lib/base.php(976): OC::handleLogin(Object(OC\AppFramework\Http\Request)) #12 /home2/boydhana/public_html/cloud.boydhanaleiako.me/index.php(42): OC::handleRequest() #13 {main}

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

Steps to replicate it:

  1. Upgrade to 15.0.4

The output of your Nextcloud log in Admin > Logging:

{"reqId":"XGvCzkXDfD0ADN66JEEAAALY","level":3,"time":"2019-02-19T08:48:15+00:00","remoteAddr":"173.244.44.81","user":"bako","app":"PHP","method":"GET","url":"\/ocs\/v2.php\/core\/navigation\/apps?absolute=true&format=json","message":"Doctrine\\DBAL\\Exception\\InvalidFieldNameException: An exception occurred while executing 'SELECT `uid`, `displayname` FROM `oc_users` WHERE `uid_lower` = ?' with params [\"bako\"]:\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 'uid_lower' in 'where clause' at \/home2\/boydhana\/public_html\/cloud.boydhanaleiako.me\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractMySQLDriver.php#71","userAgent":"Mozilla\/5.0 (Macintosh) mirall\/2.5.1final (build 20181204) (Nextcloud)","version":"15.0.4.0"}

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

<?php
$CONFIG = array (
  'instanceid' => '<censored>',
  'passwordsalt' => '<censored>',
  'secret' => '<censored>',
  'trusted_domains' =>
  array (
    0 => 'cloud.boydhanaleiako.me',
    1 => 'box861.bluehost.com',
    2 => 'localhost',
    3 => 'boydhanaleiako.me',
    4 => 'bluehost.com',
  ),
  'datadirectory' => '/home2/boydhana/public_html/cloud.boydhanaleiako.me/data',
  'overwrite.cli.url' => 'https://cloud.boydhanaleiako.me',
  'dbtype' => 'mysql',
  'version' => '15.0.4.0',
  'dbname' => 'boydhana_owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => '<censored>',
  'dbpassword' => '<censored>',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '587',
  'mail_from_address' => 'jarvis.system.notifier',
  'mail_domain' => 'gmail.com',
  'loglevel' => 0,
  'theme' => '',
  'maintenance' => false,
  'appstore.experimental.enabled' => true,
  'trashbin_retention_obligation' => 'auto',
  'mail_smtpauthtype' => 'PLAIN',
  'debug' => true,
);

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

No acces from Hosting Provider

From which version did you upgrade to 15.0.4 ?

I don’t recall exactly. I want to something under 15. I did a migrate a couple of weeks ago and updated through all the major versions that were available at the time. I don’t know if there’s a way for me to roll back to what it was before.

The error says that in table oc_authtoken the field ‘version’ does not exist. So somewhere between your ‘old’ version and version 15.0.4 this field was added. If you ‘stepped’ over the Nextcloud version which added this field, then it has been lost.
Example: Your old version had been 10, the field was added in version 11 and you upgraded from 10 to 12 directly then you lost the field and it never was added to the database table.

so 'php occ db:convert-type`? I know with owncloud the OCC command had something to set the db correctly.

That would be bad behaviour for database updaes, imo the database should have a version info and the update script should have all changes ever made to the database, step by step, version by version. This way one could not miss a thing and would not be forced to install every single update.

That’s right. But it’s also obvious that the column ‘version’ is missing. So what?

I think it means version of the auth token, not nextcloud version

That’s not the point. The point is, that in table oc_authtoken the column ‘version’ is missing. That’s what the error is saying. Nextcloud 15.0.4 should have this column in the table, so somewhere during the update process this column got lost.

@FadeFx @peteman52 Rather than arguing over how things should be, can we figure out a way to fix it? Please.

1 Like

So I just manually added the “version” column to the oc_authtoken table and now I’m getting more or less the same error for a different table. I’m implied to state that the upgrade didn’t create the columns on various tables and also didn’t verify the DB tables.

missing column is added in latest version, you should try to update again manually once again

https://docs.nextcloud.com/server/15/admin_manual/maintenance/manual_upgrade.html

If you have a backup of your Nextcloud before the update you should restore it and do the update again, this time from one major version to the next witout gap.
If not you will find a backup in your Nextcloud directory ( e.g. /var/www/nextcloud) in this directory:
data/updater-/backups. Sadly without database-backup. In this directory you will find the backups of all Nextcloud versions you had installed, so you will probably see some directories like
nextcloud-13.0.2.1, nextcloud-14.0.6.0, nextcloud-15.0.2.0 .
Or you have a look at vijaydwivedi above

So I’m assuming you’re reffering to doing this; Restoring backup — Nextcloud latest Administration Manual latest documentation ?

I have data/updater-oc2df3dadbfa/backups/nextcloud-14.0.7.1 but I don’t have nextcloud-sqlbkp.bak.

what value you have put for version column?
i have seen my db, here is version value is 2 for all users so may also try this.

I had a look at my backup of 15.0.2 . There in the table ‘oc_authtoken’ exists the column ‘version’. Since your version 14.0.7.1 obviously doesn’t has this column I propose (without warranty):

  1. Rename your nextcloud directory e.g. nextcloud_15_0_4_FirstTrial
  2. Make a backup of your nextcloud database
  3. Remove all colums you yourself did add to the nextcloud database.
  4. Copy the backup of 14.0.7.1 as nextcloud-directory
  5. Try if you can open Nextcloud in your webbrowser
  6. If you can do a update to 15.0.2