diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index a1188dec03e082a7e9430bea2b5b971429e9c8c3..a639be64e3eb0b58bc35b4cffcc98457dbfa3c8e 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -689,7 +689,10 @@ Path EvalState::findFile(SearchPath & searchPath, const string & path, const Pos
         if (pathExists(res)) return canonPath(res);
     }
     throw ThrownError({
-        .hint = hintfmt("file '%1%' was not found in the Nix search path (add it using $NIX_PATH or -I)", path),
+        .hint = hintfmt(evalSettings.pureEval
+            ? "cannot look up '<%s>' in pure evaluation mode (use '--impure' to override)"
+            : "file '%s' was not found in the Nix search path (add it using $NIX_PATH or -I)",
+            path),
         .nixCode = NixCode { .errPos = pos }
     });
 }