diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index d4c60f870ed2874effec050388a14a847208a1c9..9a04432e0d58ff0d3f4ec9fe6e372b8f1d8a8f19 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1350,6 +1350,10 @@ static void prim_catAttrs(EvalState & state, const Pos & pos, Value * * args, Va
 static void prim_functionArgs(EvalState & state, const Pos & pos, Value * * args, Value & v)
 {
     state.forceValue(*args[0]);
+    if (args[0]->type == tPrimOpApp || args[0]->type == tPrimOp) {
+        state.mkAttrs(v, 0);
+        return;
+    }
     if (args[0]->type != tLambda)
         throw TypeError(format("'functionArgs' requires a function, at %1%") % pos);