The length of substring can’t be longer than ‘x’ which is the length of the source string.

This error is complaining your Power Automate substring function have invalid parameter.

When your parameter consist 10 characters, when you call substring function for instance:

Substring([your parameter],0,255)

you will get an error:

The length of substring can’t be longer than ‘10’ which is the length of the source string.

To solve it you need to ensure [your parameter is shorter than 255 characters by If expression. Here is my solution:

If(greaterOrEquals(length([your parameter]),255),substring([your parameter],0,255),[your parameter])

--

--