SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null


#1

Steps to reproduce

1.Upload file type that was never uploaded before with the desktop client. Didn’t try with web gui
2.
3.

Expected behaviour

No errors

Actual behaviour

Exception: An exception occurred while executing ‘INSERT INTO oc_filecache (mimepart, mimetype, mtime, size, etag, storage_mtime, permissions, checksum, parent, path_hash, path, name, storage) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [“25”, null, 1540576336, 2758468, “f9f45d94e48bbede62812d68f6e9c495”, 1540576336, 27, “SHA1:1acf3491eb6609fb3f736dd8ef06d60f6fe618c4 MD5:a88f4c617ed6aaf42482f8f761a84f61 ADLER32:9232d732”, 1699, “3e97c8c177652b7d8eda9e17eadb77ae”, “files/Static/test.xlsm”, “test.xlsm”, 10]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘mimetype’ cannot be null

Server configuration

Operating system:debian 9

**Web server:**apache2

**Database:**mysql

**PHP version:**php 7.0

ownCloud version: 10.0.10.4

Updated from an older ownCloud or fresh install: fresh

Where did you install ownCloud from: tar

Signing status (ownCloud 9.0 and above):

No error

The content of config/config.php:

"system": {
        "instanceid": "oc9z7me4skno",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "exemple.com"
        ],
        "trusted_proxies": [
            "192.168.0.20",
            "192.168.0.30"
        ],
        "datadirectory": "\/owncloud\/data",
        "overwritehost": "exemple.com",
        "overwriteprotocol": "https",
        "overwrite.cli.url": "https:\/\/exemple.com",
        "dbtype": "mysql",
        "version": "10.0.10.4",
        "dbname": "owncloud_d",
        "dbhost": "localhost:\/var\/lib\/proxysql\/proxysql.sock",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "loglevel": 2,
        "logfile": "\/var\/log\/owncloud.log",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "mail_smtpmode": "sendmail",
        "ldapIgnoreNamingRules": false,
        "integrity.ignore.missing.app.signature": [
            "mytheme"
        ]
    },

List of activated apps:

Enabled:
  - comments: 0.3.0
  - configreport: 0.1.1
  - dav: 0.4.0
  - federatedfilesharing: 0.3.1
  - files: 1.5.1
  - files_external: 0.7.1
  - files_pdfviewer: 0.10.0
  - files_sharing: 0.11.0
  - files_texteditor: 2.3.0
  - files_trashbin: 0.9.1
  - files_versions: 1.3.0
  - files_videoplayer: 0.9.8
  - mytheme: 1.0.0
  - gallery: 16.1.1
  - market: 0.3.0
  - systemtags: 0.3.0
  - templateeditor: 0.4.0
  - updatenotification: 0.2.1
  - user_ldap: 0.13.0
Disabled:
  - encryption
  - federation
  - notifications
  - provisioning_api

**Are you using external storage, if yes which one:**No

Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory

LDAP configuration (delete this part if not used)


Client configuration

Browser: Desktop client

Operating system: Windows 7

Logs

ownCloud log (data/owncloud.log)

app:webdav
level:FATAL
File:/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
Exception:Doctrine\DBAL\Exception\NotNullConstraintViolationException
Line:112
Stack:
#0 /owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(128): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
#1 /owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1015): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'INSERT INTO `oc...', Array)
#2 /owncloud/lib/private/DB/Connection.php(207): Doctrine\DBAL\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)
#3 /owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(208): OC\DB\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)
#4 /owncloud/lib/private/DB/QueryBuilder/QueryBuilder.php(141): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /owncloud/lib/private/DB/Adapter.php(198): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /owncloud/lib/private/DB/Connection.php(260): OC\DB\Adapter->upsert('*PREFIX*filecac...', Array, Array)
#7 /owncloud/lib/private/Files/Cache/Cache.php(277): OC\DB\Connection->upsert('*PREFIX*filecac...', Array, Array)
#8 /owncloud/lib/private/Files/Cache/Cache.php(230): OC\Files\Cache\Cache->insert('files/Static...', Array)
#9 /owncloud/lib/private/Files/Cache/Scanner.php(281): OC\Files\Cache\Cache->put('files/Static...', Array)
#10 /owncloud/lib/private/Files/Cache/Scanner.php(218): OC\Files\Cache\Scanner->addToCache('files/Static...', Array, -1)
#11 /owncloud/lib/private/Files/Cache/Scanner.php(326): OC\Files\Cache\Scanner->scanFile('files/Static...', 3, '1699', false, false)
#12 /owncloud/lib/private/Files/Cache/Updater.php(124): OC\Files\Cache\Scanner->scan('files/Static...', false, 3, false)
#13 /owncloud/apps/dav/lib/Connector/Sabre/File.php(102): OC\Files\Cache\Updater->update('files/Static...', 1540576336)
#14 /owncloud/apps/dav/lib/Connector/Sabre/File.php(277): OCA\DAV\Connector\Sabre\File->handleMetadataUpdate(Object(OCA\Files_Trashbin\Storage), 'files/Static...')
#15 /owncloud/apps/dav/lib/Connector/Sabre/Directory.php(172): OCA\DAV\Connector\Sabre\File->put(Resource id #76)
#16 /owncloud/lib/composer/sabre/dav/lib/DAV/Server.php(1095): OCA\DAV\Connector\Sabre\Directory->createFile('test...', Resource id #76)
#17 /owncloud/lib/composer/sabre/dav/lib/DAV/CorePlugin.php(525): Sabre\DAV\Server->createFile('files/USER/...', Resource id #76, NULL)
#18 [internal function]: Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
#19 /owncloud/lib/composer/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)
#20 /owncloud/lib/composer/sabre/dav/lib/DAV/Server.php(479): Sabre\Event\EventEmitter->emit('method:PUT', Array)
#21 /owncloud/lib/composer/sabre/dav/lib/DAV/Server.php(254): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
#22 /owncloud/apps/dav/lib/Server.php(298): Sabre\DAV\Server->exec()
#23 /owncloud/apps/dav/appinfo/v2/remote.php(31): OCA\DAV\Server->exec()
#24 /owncloud/remote.php(165): require_once('/owncloud/apps/...')
#25 {main}

#2

In my tests I found that I cannot delete the failed files. But I can rename them and delete the renamed ones. After that, I don’t see the failed files on owncloud web gui but they are still present on the file system (an ‘ls’ shows the failed files).

After cleaning up the mess, I put back the same files without any errors.


#3

Hey,

i did the following search: https://github.com/owncloud/core/search?q="Column+‘mimetype’+cannot+be+null"&unscoped_q="Column+‘mimetype’+cannot+be+null"&type=Issues and found a quite old bug report https://github.com/owncloud/core/issues/2650.

If this is now happening again in newer ownCloud versions then i think it could make sense to create a new bugreport.