Sabre\DAV\Exception: Unknown error while seeking content. (Error occuring in remote.php, catching exception and error)

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, 20.0.5): Nextcloud Hub 6 (27.1.0)
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25): 2.4.52-1ubuntu4.6
PHP version (eg, 7.4): 8.1.2-1ubuntu2.14 (cli)

The issue you are facing:
I’m seeing this error occurring often, five, ten or more times a day, almost every day. Nextcloud seems to be working fine though, syncing without errors and with no other problems.

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

Steps to replicate it:

  1. No steps: I’ve searched the web and this forum and not found a similar problem. I have no idea what’s causing it or where to start troubleshooting.

The output of your Nextcloud log in Admin > Logging:

Error	webdav	Sabre\DAV\Exception: Unknown error while seeking content
 
    /var/www/nextcloud/apps/dav/lib/BulkUpload/MultipartRequestParser.php - line 129:
 
    OCA\DAV\BulkUpload\MultipartRequestParser->isAt()
 
    /var/www/nextcloud/apps/dav/lib/BulkUpload/BulkUploadPlugin.php - line 71:
 
    OCA\DAV\BulkUpload\MultipartRequestParser->isAtLastBoundary()
 
    /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:
 
    OCA\DAV\BulkUpload\BulkUploadPlugin->httpPost()
 
    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 472:
 
    Sabre\DAV\Server->emit()
 
    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 253:
 
    Sabre\DAV\Server->invokeMethod()
 
    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 321:
 
    Sabre\DAV\Server->start()
 
    /var/www/nextcloud/apps/dav/lib/Server.php - line 365:
 
    Sabre\DAV\Server->exec()
 
    /var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:
 
    OCA\DAV\Server->exec()
 
    /var/www/nextcloud/remote.php - line 172:
 
    require_once("/var/www/ne ... p")

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

<?php
$CONFIG = array (
  'instanceid' => '*******',
  'passwordsalt' => '*******',
  'secret' => '*******',
  'trusted_domains' => 
  array (
    0 => 'XXX.XXX.XXX.XXX',
    1 => '*******.COM',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '27.1.0.7',
  'overwrite.cli.url' => 'http://XXX.XXX.XXX.XXX',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '*******',
  'installed' => true,
  'mail_from_address' => '*******',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '*******.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '*******.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => '*******.com',
  'mail_smtppassword' => '*******',
  'mail_smtpsecure' => 'ssl',
  'default_phone_region' => 'US',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
);

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

Not sure which log file this refers to. There are many logs at /var/log/apache: access, error, nextcloud_access, nextcloud_error, and other_vhosts_access.

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.

    /var/www/nextcloud/remote.php - line 172:
 
    require_once("/var/www/ne ... p")

AND FINALLY, here is a snippet of the remote.php log referenced in error above, lines 172-177:

        $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
        require_once $file;
} catch (Exception $ex) {
        handleException($ex);
} catch (Error $e) {
        handleException($e);
}




Try these Search results for 'Sabre\DAV\Exception: Unknown error while seeking content' - Nextcloud community

And on github `Sabre\DAV\Exception` `Unknown error while seeking content` upload error leads to client freeze · Issue #30424 · nextcloud/server · GitHub

See above.

Thanks for the reply, just! I’ve read those, and while they share the Sabre\DAV\Exception, they differ as to the actual error. And as I said, my instance is syncing fine. Clients are all behaving fine. I just keep seeing that annoying error, and would like to solve it.

You posted the error, but there should be a transaction - presumably a POST - immediately before the error. That will tell you the client request and details (IP address, client software) triggering the error condition.

Thanks for that info, jtr. I assume you mean that I didn’t post full remote.php file, and not the Nextcloud log? Because I did post the log at top of the page. I’ll include the complete remote.php below. I’ve read it over and can’t see anything obvious, but I admit it’s over my pay grade.

    <?php
     
    require_once __DIR__ . '/lib/versioncheck.php';
     
    use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
    use Sabre\DAV\Exception\ServiceUnavailable;
    use Sabre\DAV\Server;
    use Psr\Log\LoggerInterface;
     
    /**
     * Class RemoteException
     * Dummy exception class to be use locally to identify certain conditions
     * Will not be logged to avoid DoS
     */
    class RemoteException extends Exception {
    }
     
    /**
     * @param Exception|Error $e
     */
    function handleException($e) {
            try {
                    $request = \OC::$server->getRequest();
                    // in case the request content type is text/xml - we assume it's a WebDAV request
                    $isXmlContentType = strpos($request->getHeader('Content-Type'), 'text/xml');
                    if ($isXmlContentType === 0) {
                            // fire up a simple server to properly process the exception
                            $server = new Server();
                            if (!($e instanceof RemoteException)) {
                                    // we shall not log on RemoteException
                                    $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->get(LoggerInterface::class)));
                            }
                            $server->on('beforeMethod:*', function () use ($e) {
                                    if ($e instanceof RemoteException) {
                                            switch ($e->getCode()) {
                                                    case 503:
                                                            throw new ServiceUnavailable($e->getMessage());
                                                    case 404:
                                                            throw new \Sabre\DAV\Exception\NotFound($e->getMessage());
                                            }
                                    }
                                    $class = get_class($e);
                                    $msg = $e->getMessage();
                                    throw new ServiceUnavailable("$class: $msg");
                            });
                            $server->exec();
                    } else {
                            $statusCode = 500;
                            if ($e instanceof \OC\ServiceUnavailableException) {
                                    $statusCode = 503;
                            }
                            if ($e instanceof RemoteException) {
                                    // we shall not log on RemoteException
                                    OC_Template::printErrorPage($e->getMessage(), '', $e->getCode());
                            } else {
                                    \OC::$server->get(LoggerInterface::class)->error($e->getMessage(), ['app' => 'remote','exception' => $e]);
                                    OC_Template::printExceptionErrorPage($e, $statusCode);
                            }
                    }
            } catch (\Exception $e) {
                    OC_Template::printExceptionErrorPage($e, 500);
            }
    }
     
    /**
     * @param $service
     * @return string
     */
    function resolveService($service) {
            $services = [
                    'webdav' => 'dav/appinfo/v1/webdav.php',
                    'dav' => 'dav/appinfo/v2/remote.php',
                    'caldav' => 'dav/appinfo/v1/caldav.php',
                    'calendar' => 'dav/appinfo/v1/caldav.php',
                    'carddav' => 'dav/appinfo/v1/carddav.php',
                    'contacts' => 'dav/appinfo/v1/carddav.php',
                    'files' => 'dav/appinfo/v1/webdav.php',
                    'direct' => 'dav/appinfo/v2/direct.php',
            ];
            if (isset($services[$service])) {
                    return $services[$service];
            }
     
            return \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service);
    }
     
    try {
            require_once __DIR__ . '/lib/base.php';
     
            // All resources served via the DAV endpoint should have the strictest possible
            // policy. Exempted from this is the SabreDAV browser plugin which overwrites
            // this policy with a softer one if debug mode is enabled.
            header("Content-Security-Policy: default-src 'none';");
     
            if (\OCP\Util::needUpgrade()) {
                    // since the behavior of apps or remotes are unpredictable during
                    // an upgrade, return a 503 directly
                    throw new RemoteException('Service unavailable', 503);
            }
     
            $request = \OC::$server->getRequest();
            $pathInfo = $request->getPathInfo();
            if ($pathInfo === false || $pathInfo === '') {
                    throw new RemoteException('Path not found', 404);
            }
            if (!$pos = strpos($pathInfo, '/', 1)) {
                    $pos = strlen($pathInfo);
            }
            $service = substr($pathInfo, 1, $pos - 1);
     
            $file = resolveService($service);
     
            if (is_null($file)) {
                    throw new RemoteException('Path not found', 404);
            }
     
            $file = ltrim($file, '/');
     
            $parts = explode('/', $file, 2);
            $app = $parts[0];
     
            // Load all required applications
            \OC::$REQUESTEDAPP = $app;
            OC_App::loadApps(['authentication']);
            OC_App::loadApps(['extended_authentication']);
            OC_App::loadApps(['filesystem', 'logging']);
     
            switch ($app) {
                    case 'core':
                            $file = OC::$SERVERROOT .'/'. $file;
                            break;
                    default:
                            if (!\OC::$server->getAppManager()->isInstalled($app)) {
                                    throw new RemoteException('App not installed: ' . $app);
                            }
                            OC_App::loadApp($app);
                            $file = OC_App::getAppPath($app) .'/'. $parts[1];
                            break;
            }
            $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
            require_once $file;
    } catch (Exception $ex) {
            handleException($ex);
    } catch (Error $e) {
            handleException($e);
    }

As I implied in my last post, this in the weeds stuff is beyond me. But I’m reading up, checking the documentation, trying to catch a clue.

I’m wondering if the biggest clue isn’t contained right in the log entries:
Sabre\DAV\Exception: Unknown error while seeking content.

I do not think I ever installed any packages that might have enabled sabre\dav, I have not created a sabre\dav server. I do not see any directory anywhere for it.

I am using and sharing files for all my users on external storage, and I see a setting on the admin page for External Storage to “Allow users to mount external storage”, but I do not have the WebDAV option ticked or enabled. I only have the Nextcloud option enabled.

I might be barking up a totally wrong tree, but possibly this will mean something to someone here.

ADDING: And then there’s this, at the top of my remote.php file (posted above):

use Sabre\DAV\Exception\ServiceUnavailable;

I don’t know if this means anything, but I discovered I can connect to my external storage via webDAV from my Mac desktop “Go > Connect to Server.”

I still have no solution to why this happened…BUT: the good news for me is that the error has stopped occurring.

I did find and correct a problem with one of the clients, where some files had failed to sync due to being named with leading/trailing spaces. They had been stuck there, prevented from syncing for maybe six weeks. Since I renamed those files, I haven’t seen the error again.

Even though I don’t understand what connection there might be between the two, I’m hoping I’ve seen the last of that error. And so I am marking this question as solved.