It could be a random thing. That happens sometimes. A shop will typically verify by clearing it and driving it again to see if it returns.
Each DTC has a certain set of conditions that must be met before it will set. So depending on the code and the required conditions it may come back right away or take a while. You can clear the codes by disconnecting the battery for a few minutes.
If the cruise is behaving strangely, then it could be a speed sensor problem. You need to see what the code is.
Oh, and any diesel in recent truck will have a 4R100W (E4OD) in it.
Steve