The sequence is yellow, then blue, then black, then red.
Order is the entire puzzle here — the bricks only stack correctly in that progression, and putting one out of place stops the rest from seating.
If it is not working, clear the stack and start again from yellow rather than trying to slot a brick in partway through. The colour sequence is short enough that a restart costs you almost nothing.