I’m not super savvy with lua so this assessment may or may not be wrong.
So heres the code block in question that’s throwing an error.
if not self.order.isFulfillable then
for _, reagentInfo in ipairs(self.order.reagents) do
local allocations = transaction:GetAllocations(reagentInfo.slotIndex);
-- isBasicReagent check here to handle multiple allocations within the same slot (qualities)
if not self.reagentSlotProvidedByCustomer[reagentInfo.slotIndex] or not reagentInfo.isBasicReagent then
allocations:Clear();
self.reagentSlotProvidedByCustomer[reagentInfo.slotIndex] = true;
end
-- These allocations get cleared before sending the craft, but we allocate them for craft readiness validation
allocations:Allocate(reagentInfo.reagent, reagentInfo.reagent.quantity);
reagentSlotToItemID[reagentInfo.slotIndex] = reagentInfo.reagent.itemID;
end
end
The error in question: attempt to index local 'allocations' (a nil value)
on line 564 is when it is calling allocations:Clear();
. Indexing allocations comes earlier via the line
local allocations = transaction:GetAllocations(reagentInfo.slotIndex);
If we look at the data given at time of error, we can see we are at slotIndex 10.
reagentInfo = <table> {
slotIndex = 10
reagent = <table> {
}
source = 0
isBasicReagent = false
}
But if we look at the table reagentSlotToItemID where it is assigning item IDs to reagent slots, there is no slot 10.
reagentSlotToItemID = <table> {
1 = 228930
2 = 222803
3 = 219951
5 = 211296
8 = 222794
}
So when allocations is getting indexed, its calling on reagentinfo for slot 10 which is nil, resulting in allocations being nil. When I testing this out, I used all level 1 materials.
if not self.reagentSlotProvidedByCustomer[reagentInfo.slotIndex] or not reagentInfo.isBasicReagent then
So since its or, one of those 2 conditions has to be met to continue on to the line of code that fails. The first should always fail in public orders as every reagent must be provided by the customer, but we can see in the error that reagentInfo.isBasicReagent is true (fails) and the table reagentSlotProvidedByCustomer is completely empty and so the reagentInfo.slotIndex value in the table would return nil, returning false, but it’s got that not keyword, so really it’s true, satisfying the if conditional.
So something is causing the craft to move onto an index that doesn’t exist. Since the comment mentions quality, and the error didn’t happen when I submitted a public order with all rank 1 materials, it’s likely this error will only happen when some material is posted at either quality level 2 or 3 (maybe mixed quality levels?), but its weird that its only happening on the 2 bracer crafts and not any of the others these materials are used in.