Part of the box office bomb dilemma occurs long before a film is released - when overly anxious executives green light a movie and provide directors with a ridiculously high budget. Admittedly, you've got to spend money to make money, so it's understandable that producers invest outrageous bucks in big name stars and expensive CGI effects to help give their project the best chance at success.
Sometimes it works: last year's risky Snow White and the Huntsman made almost $400 million globally on a reported $170 million budget; but other times it doesn't, like with After Earth, which only made $60 million domestically on a $130 million budget. After Earth ultimately earned back its production costs through international ticket sales (bringing in a total of $235 million) but it's still hard to determine where that original $130 million was even spent in the first place. In spite of a few slick CGI sequences, After Earth wasn't particularly grand in scale - meaning that, with careful planning, the studio and director M. Night Shyamalan could have probably reined in the spending without negatively impacting the production (since the final film was still panned by critics and most moviegoers).
Many filmmakers and executives put the cart before the horse - assuming that bigger is better. While big-budgeted movies, fueled by an expensive lead and over-the-top visuals set pieces, might make for good pre-release marketing. Once the movie is out, it has to be able stand in the court of public opinion (as mentioned, high production values and recognizable stars aren't a guaranteed formula for box office success). Taking a more modest approach to pre-production - i.e. not trying to turn every script into a tentpole blockbuster - could lower the cost of certain film budgets and deliver more balanced (and better quality) movie experiences overall.