When typing with polars.datatypes.Array you should explicitly set array length:
# For arrays of 3 int8 elements:
correct_dtype = pl.Array(pl.Int8, 3) # ✅ pl.Array(dtype, size)
df.with_columns(pl.col("values").map_batches(udf, return_dtype=correct_dtype))
If length is unknown you could use polars.datatypes.List