Gremlin code not working some times?

Hi @luigidellaquila
the below gremlin code works

another image added in reply

sometimes showing error

May I know how to fix please?

Hi @hanzgs

the error seems related to script parsing. Is it the same query that works or not or is it different?