diff --git a/aeson-value-parser.cabal b/aeson-value-parser.cabal
--- a/aeson-value-parser.cabal
+++ b/aeson-value-parser.cabal
@@ -1,5 +1,5 @@
 name: aeson-value-parser
-version: 0.19.2
+version: 0.19.2.1
 synopsis: API for parsing "aeson" JSON tree into Haskell types
 description:
   A flexible parser DSL of JSON AST produced by the \"aeson\" library
@@ -35,7 +35,7 @@
   build-depends:
     aeson ==1.*,
     attoparsec >=0.13 && <0.14,
-    base >=4.9 && <5,
+    base >=4.12 && <5,
     bytestring >=0.10 && <0.12,
     hashable >=1.3 && <2,
     megaparsec >=8 && <10,
diff --git a/library/AesonValueParser.hs b/library/AesonValueParser.hs
--- a/library/AesonValueParser.hs
+++ b/library/AesonValueParser.hs
@@ -177,8 +177,16 @@
 {-# INLINE mappedText #-}
 mappedText :: [(Text, a)] -> String a
 mappedText mappingList = let
-  !hashMap = HashMap.fromList mappingList
-  in narrowedText (flip HashMap.lookup hashMap)
+  expectedValuesText = fromString (show (fmap fst mappingList))
+  match lookup text = case lookup text of
+    Just a -> Right a
+    _ -> Left ("Unexpected value: \"" <> text <> "\". Expecting one of: " <> expectedValuesText)
+  mappingListLength = length mappingList
+  in if mappingListLength > 512
+    then let
+      !hashMap = HashMap.fromList mappingList
+      in matchedText (match (flip HashMap.lookup hashMap))
+    else matchedText (match (flip lookup mappingList))
 
 {-# INLINE narrowedText #-}
 narrowedText :: (Text -> Maybe a) -> String a
