If this happens again, you probably need to run a refresh all... most likely you had one of those lovely inventory out of synch things, since this is the way it works:
1) Decide best item.
2) Try to get item. If item amount before/after this happens is the same, mark the item as a failure and skip in the future, otherwise leave our partial creation and recalculate giving the following message:
verbose("Something went wrong with getting "+item+" for "+price+". Recalculating.");
3) Find best item. If inventory had changed in step 2, this can still be the same best item, but hopefully a lower amount. If this happens, it means our inventory belief is inaccurate. If caught early enough, this is how bugs get found. If inventory had not changed, the item is eliminated and it's something else as best. This could be an inaccurate inventory belief, or caused by trying to set variables manually.
Basically, if this error message comes up and we were able to have our inventory to change at all, the item availability should be accurate. If it didn't, it means that your inventory is screwed up and can't be trusted. Due to that it checks all item areas, you might need to do a refresh all to actually get it to return to accuracy, if it was using an outfit to purchase some of the items. Also possible... you did something bad with variables, like trying to disable using your inventory, or enable using the closet, or something else like that. I warned about that back in post 1101, albeit obliquely, and asked if we wanted custom retrieval code or keep using retrieve_item. As long as we're using retrieve_item, if you try to set USE_INV outside of simulation, you WILL break things. These can still be used for simulation... but then your simulation and actual execution will not return the same results. The only way to avoid this is to:
a) Leave it like this. People breaking their system, counter to usage is something that can't be easily stopped.
b) Scrap the variables, read the preferences 50 times in the script. Inefficient, but almost impossible to break.
c) Try to do randomized variables. When the script begins its execution, generate a random 5-10 digit number that gets appended to the variable. This would break anyone using old aliases, but new people trying to break their system would just find the static name of the random addition and append that automatically to make their scripts break again. Ultimately a useless make-work.
d) Custom retrieval code instead of retrieve_item, as noted in 1101, 1099, 1095, 1093, 1091, 1089, and probably some more posts from earlier.