Normally I'd say the gig.
But I'm a mercenary.
Of the 115 gigs I played last year, the lion's share were with my main band.
I've had 2 schedule conflicts with them in the past two years. In both cases no one had to think twice about getting a sub.
OTOH, the fact that you have a choice of festival slots muddies the water.
Not knowing your guitarist's reason for being unavailable - not that it matters if he already blacked out the date - or how big a deal the headline slot actually is, etc, it's hard to say.
Also, are there issues with your guitarist beyond this one date? Could this be an opportunity to audition the sub?
Can you get a sub?
Or do your guitarist's values outweigh any issues he might have? Would taking the headline slot and subbing out his position be likely to cause otherwise avoidable resentments?
Also keep in mind that headline slot may end up being not all it's cranked up to be:
I've done a lot of festivals over the past 45-50 years, some headlining, some opening, some in between somewhere.
We put in our request for a headline slot for one in 1990 where a lot of local DFW heavy hitters were billed. Despite a strong value-prop - we were the only rock & motown party dance band on the bill at a festival that promised a spirited, dancing crowd, we were given the #2, early afternoon slot initially, with the headline slot being offered to the 2-time Grammy winning Brave Combo.
Brave Combo then requested our slot since they had an out-of-state gig that night, so we were shuffled to the #3, mid-afternoon slot.
Ours turned out to be the best slot of the festival. We followed Brave Combo, who had everyone on their feet their whole set, and we were able to dove-tail our set into their energy.
Since I was a huge fan of the festival's second-choice headline band, I stuck around. By the time they took the stage, most of the crowd had tapped out. Sometimes "headlining" just means sticking around to lock the doors.
Also, a good rule of thumb with festivals is to accept that they often don't go the way you think they will.