diff --git a/lib/spack/spack/provider_index.py b/lib/spack/spack/provider_index.py
index 3f9cd285e717a04080c52fcae72e1e118d37b6fd..2be48b43c1d2544a0b10c1ab16282b8f63176e6e 100644
--- a/lib/spack/spack/provider_index.py
+++ b/lib/spack/spack/provider_index.py
@@ -32,6 +32,7 @@
 from yaml.error import MarkedYAMLError
 
 import spack
+import spack.error
 
 
 class ProviderIndex(object):
@@ -201,11 +202,10 @@ def from_yaml(stream):
                 "error parsing YAML ProviderIndex cache:", str(e))
 
         if not isinstance(yfile, dict):
-            raise spack.spec.SpackYAMLError(
-                "YAML ProviderIndex was not a dict.")
+            raise ProviderIndexError("YAML ProviderIndex was not a dict.")
 
         if 'provider_index' not in yfile:
-            raise spack.spec.SpackYAMLError(
+            raise ProviderIndexError(
                 "YAML ProviderIndex does not start with 'provider_index'")
 
         index = ProviderIndex()
@@ -291,3 +291,7 @@ def mapiter(mappings):
         (name, out_mapping_type([
             transform_fun(vpkg, pset) for vpkg, pset in mapiter(mappings)]))
         for name, mappings in providers.items())
+
+
+class ProviderIndexError(spack.error.SpackError):
+    """Raised when there is a problem with a ProviderIndex."""