The SL(2, Z) duality transformations of type IIB supergravity are shown to
be anomalous in generic F-theory backgrounds due to the anomalous transform
ation of the phase of the chiral fermion determinant. The anomaly is partia
lly cancelled provided the ten-dimensional type IIB theory lagrangian conta
ins a term that is a ten-form made out of the composite U(1) field strength
and four powers of the curvature. A residual anomaly remains uncancelled,
and this implies a certain topological restriction on consistent background
s of the euclidean theory. A similar, but slightly stronger, restriction is
also derived from an explicit F-theory compactification on K-3 x M-8 (wher
e M-8 is an eight-manifold with a nowhere vanishing chiral spinor) where th
e cancellation of tadpoles for Ramond-Ramond fields is only possible if M-8
has an Euler character that is a positive multiple of 24. The interpretati
on of this restriction in the dual heterotic theory on T-2 x M-8 is also gi
ven.