diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php
index 72275ac12057711c6ecb61ceb7e0b2e399c78243..50592f36ada20b1446d3a23d91ee24fec03c508f 100644
--- a/lib/private/ServerContainer.php
+++ b/lib/private/ServerContainer.php
@@ -133,6 +133,12 @@ class ServerContainer extends SimpleContainer {
 	public function query(string $name, bool $autoload = true) {
 		$name = $this->sanitizeName($name);
 
+		try {
+			return parent::query($name, false);
+		} catch (QueryException $e) {
+			// Continue with general autoloading then
+		}
+
 		// In case the service starts with OCA\ we try to find the service in
 		// the apps container first.
 		if (($appContainer = $this->getAppContainerForService($name)) !== null) {