diff --git a/arraycontext/impl/pytato.py b/arraycontext/impl/pytato.py
index cb6a58836fd41f830c7f31044566bcac85fc2109..7d4f09f07bba5f603b9e407dd210c0049bb5f0aa 100644
--- a/arraycontext/impl/pytato.py
+++ b/arraycontext/impl/pytato.py
@@ -261,8 +261,8 @@ class PytatoCompiledOperator:
         if not is_array_container(outputs):
             # TODO: We could possibly just short-circuit this interface if the
             # returned type is a scalar. Not sure if it's worth it though.
-            raise ValueError(f"Function {self.f.__name__} to be compiled did not"
-                             " return an array container.")
+            raise ValueError(f"Function '{self.f.__name__}' to be compiled did not"
+                             f" return an array container, but '{outputs}' instead.")
 
         def _as_dict_of_named_arrays(keys, ary):
             name = "_pt_out_" + "_".join(str(key)
diff --git a/test/test_arraycontext.py b/test/test_arraycontext.py
index 5623fedf15829d355f2351bf8e10d221436dc079..2fb7ea0d87fb180e9ca52c6290d08a4dd3efddbf 100644
--- a/test/test_arraycontext.py
+++ b/test/test_arraycontext.py
@@ -759,6 +759,7 @@ def test_norm_ord_none(actx_factory, ndim):
 class Velocity2D:
     u: np.ndarray
     v: np.ndarray
+    array_context: ArrayContext
 
 
 def scale_and_to_speed(alpha, vel):
@@ -777,7 +778,9 @@ def test_actx_compile(actx_factory):
     v_x = np.random.rand(10)
     v_y = np.random.rand(10)
 
-    vel = actx.from_numpy(Velocity2D(v_x, v_y))
+    from arraycontext import from_numpy
+
+    vel = from_numpy(Velocity2D(v_x, v_y, actx), actx)
 
     scaled_speed = compiled_rhs(3.14, vel)