diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index ef3197410c7f16b2ab19e1279bf0d9eb3684b8c1..3657a5ffaf66c8cbf568faca764aa557bee2e2c8 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -2152,8 +2152,14 @@ class SimpleSAML_Utilities {
 		if (isset($candidates[$idpmetadata['auth']])) {
 			return $candidates[$idpmetadata['auth']];
 		}
-		throw new SimpleSAML_Error_Exception('You need to set \'authority\' in the metadata for ' .
-			var_export($idpmetadata['entityid'], TRUE) . '.');
+		if (strpos($idpmetadata['auth'], '/') !== FALSE) {
+			/* Probably a file. */
+			throw new SimpleSAML_Error_Exception('You need to set \'authority\' in the metadata for ' .
+				var_export($idpmetadata['entityid'], TRUE) . '.');
+		} else {
+			throw new SimpleSAML_Error_Exception('Unknown authsource ' .
+				var_export($idpmetadata['auth'], TRUE) . '.');
+		}
 	}