Exception while scanning; undefined

Steps to reproduce
1. occ maintenance files:scan --username

Expected behaviour
Normal file scan and update ending with output of folder, files and elapsed time

Actual behaviour
Exception while scanning: Undefined index: parent
0 /var/www/owncloud/lib/private/Files/Cache/Cache/php(146): OCA\Files\Command\Scan->exceptionErrorHandler(8, 'Undefined index...', '/var/www/ownclo...', 146, Array)

Server configuration
Operating system: Ubuntu 14.04
Web server: Apache
Database: MySQL
PHP version: 5
ownCloud version (see ownCloud admin page): 9.1.1
Updated from an older ownCloud or fresh install: updated from 9.1.0 as part of the troubleshooting. Issue started with 9.1.0
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption):External storage is being scanned

ownCloud log (data/owncloud.log)

Please paste possible errors in the following code block, see https://central.owncloud.org/t/how-to-find-webserver-or-oc-logfile-enable-php-logfile/808 for more info

Exception while scanning: Undefined index: parent
#0 /var/www/owncloud/lib/private/Files/Cache/Cache/php(146):  OCA\Files\Command\Scan->exceptionErrorHandler(8, 'Undefined index...', '/var/www/ownclo...', 146, Array)

Integrity status for oC9+

No errors have been found.

Can you create a new test.php with the following content:

<?php
print(php_sapi_name()."\n");
?>

Then run it the same way you're running the scan command and paste the output in here.

the output is simply

cli

I created test.php and ran it with

sudo -u www-data php test.php

Ok, thanks. Then please create a new issue at https://github.com/owncloud/core/issues

Thanks for creating an issue, here is the reference: