The way I see it, they were a pair of exceptionally talented young wizards who were used to doing things their own way and getting away with it.
Case in point: they joined the Order of the Phoenix but apparently kept their suspicions about the identity of the traitor in their inner circle to themselves. Sirius suspected Lupin of being the traitor, and vice versa. James and Sirius then devised a plan that depended on deceiving everyone else—a “bluff,” as Sirius called it in the third book, which could only be of any value if the bluff gave them an upper hand in eventually exposing the traitor. Even Dumbledore was kept in the dark about their last-minute decision to switch Secret Keepers to Pettigrew.
This suggests to me that James and Sirius had carried their adolescent social hierarchy into a war without entirely understanding that the qualities that had made them successful at Hogwarts might make them dangerously unreliable as adults. They were operating under the assumption that Pettigrew was their faithful admirer; that he needed their star power to feel validated; and that Voldemort would never think of approaching such a mediocre wizard, or that Pettigrew could go to Voldemort's side willingly.
They also seemed to have established a ranking of trust among the Marauders. Since Sirius suspected Lupin, we can reasonably infer that James, who trusted Sirius enough to make him his first choice for Secret Keeper and subsequently agreed to his plan to switch to Pettigrew, had reservations about Lupin as well. Even if James didn't personally suspect Lupin of being the traitor, he was evidently willing to leave him out of the loop. And since Dumbledore, the leader of the resistance organization they had joined, was also not informed of the switch, those two were essentially going rogue within the Order.
So, while they certainly had admirable qualities, they were also profoundly immature and reckless in devising the plan that ultimately cost James and Lily their lives.