  We investigate, at the microscopic level, the compatibility between D-term
potentials from world-volume fluxes on D7-branes and non-perturbative
superpotentials arising from gaugino condensation on a different stack of
D7-branes. This is motivated by attempts to construct metastable de Sitter
vacua in type IIB string theory via D-term uplifts. We find a condition under
which the Kaehler modulus, T, of a Calabi-Yau 4-cycle gets charged under the
anomalous U(1) on the branes with flux. If in addition this 4-cycle is wrapped
by a stack of D7-branes on which gaugino condensation takes place, the question
of U(1)-gauge invariance of the (T-dependent) non-perturbative superpotential
arises. In this case an index theorem guarantees that strings, stretching
between the two stacks, yield additional charged chiral fields which also
appear in the superpotential from gaugino condensation. We check that the
charges work out to make this superpotential gauge invariant, and we argue that
the mechanism survives the inclusion of higher curvature corrections to the
D7-brane action.
