It's not the length, it's how you use it
The game should be as long as it can be without becoming/including a grind.
A game can last hundreds of hours if there is enough content that rewards you with a feeling of discovery, sense of progress or accomplishment.
But if there's not enough content or variety to sustain a feeling of challenge and achievement, when it's full of pointless bits that the player can pass on autopilot, that don't contribute to the story or give any indication of going anywhere, then it's in the game's best interest to be shorter.
The length of a game should be "as long as you can make it without padding."