The official answer is this important and confusing section from the FAQ:
Triggering Actions and Abilities
A player can only trigger an action or ability if its effect has the potential to change the game state. This potential is assessed without taking into account the consequences of paying play, install, or rez costs or triggering any further abilities.
Example: The Corp cannot play Archived Memories if there are no cards in Archives.
Scavenge’s text, for reference:
As an additional cost to play this card, trash an installed program.
Install a program from your grip or heap, lowering the install cost of that program by the cost of the program trashed.
The effect of the action of playing Scavenge is “Install a program from your grip or heap, lowering the install cost of that program by the cost of the program trashed.” The first part of Scavenge, the program trashing, is part of the cost. So, as per the FAQ, it is not taken into account when assessing if the effect has the potential to change the game state.
If you don’t have a program in your grip or heap that you can afford, then this effect on its own has no potential to change the game state, and therefore you can’t play Scavenge.
The FAQ clarification for Scavenge says:
- The Runner can trash a program as an additional cost, and then reinstall that same program.
- As part of the install action, the Runner can trash installed programs.
Neither of these things changes whether the effect has the potential to change the game state when there are no programs you can afford in your grip or heap and the cost isn’t taken into account. They only clarify what you can do when you actually play Scavenge, which you can only do if the potential-change-to-game-state check passes first.