I suffered a lot with this error and I looked for solution from LLM but still no use and than i gave a try by generating invoice than changing the state and status to complete and it worked fine.
I hope this works for anyone looking for this.