The feature with Id XXX is not installed in this farm
Problem
While working with FeatureDefinition, the following exception may pop up "the feature with Id 'XXX' is not installed in this farm".
Explanation
We could not reproduce that issue, seems to be farm, service pack or CU-related. Using FeatureDefinition.ForceActivate = true helped.
Solution
Use FeatureDefinition.ForceActivate = true