When we nine patch any image it creates a black line to its border. That border should be transparent or completely solid. If it is not, this error will come.
So the solution is to increase the width and height by two pixels. (In Photoshop increase the size of the canvas, not the image.)