diff --git a/core/src/main/java/io/kestra/core/tasks/debugs/Return.java b/core/src/main/java/io/kestra/core/tasks/debugs/Return.java index 532986dca3d..279d3af6778 100644 --- a/core/src/main/java/io/kestra/core/tasks/debugs/Return.java +++ b/core/src/main/java/io/kestra/core/tasks/debugs/Return.java @@ -15,6 +15,7 @@ import org.slf4j.Logger; import java.time.Duration; +import java.util.Optional; @SuperBuilder @ToString @@ -56,7 +57,7 @@ public Return.Output run(RunContext runContext) throws Exception { long end = System.nanoTime(); runContext - .metric(Counter.of("length", render.length(), "format", format)) + .metric(Counter.of("length", Optional.ofNullable(render).map(String::length).orElse(0), "format", format)) .metric(Timer.of("duration", Duration.ofNanos(end - start), "format", format)); return Output.builder()