During creating and assigning Sequence number in X++ code, I found this error continuously. Later i found that getting and assigning next sequence number should be written inside transaction block. for example
ttsbegin;
itemId = NumberSeq::newGetNum(InventParameters::numRefItemId()).num();
ttscommit;