If string theory is inconsistent with observations, why hasn't it been rejected yet? I'm no expert on string theory, but I've been reading about it. I've been quite surprised because of how it appears to be inconsistent with observations, but hasn't been rejected yet. Examples:
On the cosmological implications of the string Swampland

Criterion 2: The current B-mode constraint $\epsilon < 0.0044$ corresponds to $|∇ϕV|/V<0.09$, in tension with the second Swampland criterion $|∇ϕV|/V>c∼O(1)$. Near-future measurements will be precise enough to detect values of $r$ at the level of $0.01$; failure to detect would require $|∇ϕV|/V≲0.035$. The plateau models, favored by some cosmologists as the simplest remaining that fit current observations, require $|∇ϕV|/V≲0.02$ during the last 60 e-folds, which is in greater tension with the second Swampland criterion.

This seems to imply that this second Swampland criterion is inconsistent with observations by at least one order of magnitude, possibly two.
Example #2:

The conjectured formula — posed in the June 25 paper by Vafa, Georges Obied, Hirosi Ooguri and Lev Spodyneiko and further explored in a second paper released two days later by Vafa, Obied, Prateek Agrawal and Paul Steinhardt — says, simply, that as the universe expands, the density of energy in the vacuum of empty space must decrease faster than a certain rate. The rule appears to be true in all simple string theory-based models of universes. But it violates two widespread beliefs about the actual universe: It deems impossible both the accepted picture of the universe’s present-day expansion and the leading model of its explosive birth.

So string theory is inconsistent with inflation, dark energy, and Big Bang theory. Even if one argues that the observational evidence behind inflation is not rock solid, surely the other two should be on very firm ground. Why hasn't string theory been rejected yet? Or, even if string theory itself hasn't been rejected, why haven't these problematic swampland conjectures been rejected?
It's weird to me how string theorists are apparently excited by developments (as in Example #2 above) when they are seemingly fatal to the theory. The only possible explanation I can see is that string theory hasn't been falsified, it's just encountered difficulties - but if that's the case then it reminds me somewhat of steady state cosmology vs. Big Bang theory of the past, and being able to appeal to one of the $10^{500}$ possible universes in string theory as the "solution" doesn't seem appealing at all.
 A: As this question opens up a great deal of discussion, I would also like to pitch in. I am not saying that the answers already given by @anna v and @Mitchell Porter are not good and solid answers, I would like to add something very quickly.
Even if -and that is a huge if- string theory in its current formulation is proved to be inconsistent with the data it has provided a lot of insight in gauge theories. This is important by itself and has been the case even before the AdS/CFT years -see the Hanany-Witten setups for example.
Also, in light of the AdS/CFT as a solid example of the holographic principle, it has provided many examples of gauge/gravity duals where you can test how the holographic principle works on both sides and try to learn something more fundamental about quantum gravity.
Through the AdS/CFT it has also shed light on strongly coupled gauge theories, condensed matter systems, anisotropic plasma physics etc.
There are also lessons that we obtained for pure mathematics due to string theory.
I guess my argument can be briefly stated in the following way: even if it turns out to be wrong or incomplete it is a great playground for many disciplines and maybe has to teach us more.
A: You surely know that string theory has zillions of vacua. Most of these vacua can immediately be ruled out e.g. because they have the wrong number of macroscopic dimensions, or for similar reasons. But among those that remain possibilities - possessing the right qualitative possibilities - it is exceedingly difficult to calculate anything testable.
The interest in the "swampland hypotheses" - hypotheses that certain things are impossible in string theory - is that they might dramatically speed up the understanding of the theory, and its application to reality. For example, if a metastable de Sitter space lasting for cosmological durations really is impossible in string theory, then dark energy needs to be explained in some other way, e.g. via quintessence. Swampland hypotheses can also potentially have sharp implications for the allowed values of the parameters in effective field theory.
But the keyword is, potentially. None of these hypotheses have been proven. It's a little like in mathematics, where there are various high-powered propositions (generalized Riemann hypothesis, abc conjecture...) which have never been proven, but most people think they are true, and have figured out many of the further consequences, if they are true. The swampland research still has this conjectural character, and the swampland hypotheses are still challenged e.g. by the people who constructed a landscape of putative de Sitter vacua for string theory in the 2000s. Those constructions have some heuristic, not entirely rigorous ingredients, which the swampland hypotheses imply must actually be flawed. So there is a technical debate underway about whether or not they are viable.
(The implications of swampland hypotheses for the reality of the string theory landscape, and the paradigm of anthropic selection within eternal inflation, would be another reason why there is lively interest. After all, the swampland is defined as the space of field theories that aren't in the landscape.)
You could say that without the swampland debate, string theory would be stuck just with either handwaving anthropic justifications for the observed features of the world, or the slow technical improvement in the ability to calculate particle properties. The swampland debate is an opportunity to move ahead on a third front.
A: As an experimental physicist I will answer the title. The examples of inconsistency in the question deal with many assumptions on cosmological  observations and models, and are answered by  @MitchellPorter.

If string theory is inconsistent with observations, why hasn't it been rejected yet?

The standard model of particle physics is an encapsulation of all the data accumulated about particles up to now. A theory of everything (TOE) which is the goal of string theory and the holy grail for most theorists, should be able to embed the standard model, since it is the data, in addition to offering a solution for the quantization of gravity (which is relevant for cosmological models).
String theories are the only proposals up to now that embed the standard model (can fit the data) and allow for the quantization of gravity. This is done by an assignment of the quantum levels of the string to the $SU(3)\times SU(2) \times U(1)$ energy levels, since these groups exist in the vibrations of the generic string. That, plus a vibrational level appropriate to represent  gravitons, is what keeps the interest in string theories and their extensions alive.
There are thousand of possible versions of string theories, and theorists have not managed to pin one down so that phenomenology can become active, and that  is where we are now as far as string theory being the theory of particle physics.
So, string theories are consistent with the innumerable data of particle physics.
A: String theory doesn't make clear definitive predictions so can't be refuted from observations
The question is really one about the philosophy of science. And, depending on which scientific philosopher you follow, you will come to different conclusions about the problem of string theory.
For example, Karl Popper–to simplify a big argument a great deal–argued that good science is about making refutable hypotheses. That is, the science worth doing is about proposing a bold and clearly empirically testable theory that, when experiments are done, gives a clear result but one which, at least in principle, could prove the theory false.
Imagine suggesting a law for the force of gravity based on a cubic relationship between the force and distance. Simple observations show this fails to explain observed gravitational motion. Theory binned. New theory: it is an inverse square law. That looks consistent with most observations. But later it fails to explain some subtle observations about the orbit of mercury. A problem until Einstein and a better theory which does match achievable observations. Repeat ad infinitum.
Each theory had some clear differentiation based on which observations it could explain. IF the observations failed, the theory was replaced by a better one.
The problem with string theory is it isn't like that. In the drive to explain the unification of all forces theorists sought an overarching mathematical idea that would unify all of them in a single framework. There were some hints from Einstein-era mathematical ideas. But what emerged was not a single mathematical model with clear predictions but a family of tuneable solutions with more possible answers than there are particles in the universe (according to some analyses).
In short, there is no single string theory. There are so many variations of string theory that many of them can explain any observation we can possibly make. That really doesn't fit anything Popper would classify as science.
In response to this many string theorists have rejected Popper in favour of pushing for a definition of scientific theory that values the beauty of the mathematical framework more highly than empirical predictions. If you take their point of view seriously, there is no point in trying to test string theory from actual observations. Which is lucky as, in all the years of development of string theory, no useful empirical test of validity has emerged in the real world of observations.
Some physicists have questioned utility of the search for beautiful theories that don't make clear, testable predictions. A good recent example is Hossenfelder's "Lost in math: how beauty leads physics astray"
But the answer to the question is that a family of theories that can explain anything in reality explains nothing and can't be rejected by actual observations.
A: String theory's apparent "incompatibility" with the existence of de Sitter vacua and inflation is just a sharpening of the apparent "incompatibility" of quantum field theory, semi-classical quantum gravity and holography with de Sitter cosmological solutions and inflation.
There is a strong tension between de Sitter cosmologies and current theoretical physics, not just with string theory. Let me enumerate some examples:

*

*One famous problem with de Sitter space is the semiclassical incompatibility between the finiteness of the entropy of a given causal patch in de Sitter space given by the Hawking-Gibbons formula and the existence of hermitian operators realizing the symmetry generators of the de Sitter group in d-dimensions. Notice how robust are the arguments (based on symmetry, unitarity and holographic considerations with no more physical inputs) that have stated the problem and how drastic the consequences are.


*Infrared instabilities. Again, the arguments that state infrared problems follow from basic expectations about the marriage of quantum mechanics and the general theory of relativy.


*Absence of holography. De Sitter space has no boundary. Where does anyone expect to "localize" the "CFT" side of the gravitational bulk theory? It is true that heroic attempts to establish a dS/CFT correspondence have been developed. The truth is that it's not clear that they actually work, and in any case, the CFT side (living on the infinite timelike surface at the remote future) looks much more exotic that what is expected on physical grounds.


*Instanton mediated transitions between different de Sitter vacua, bubble nucleation, Coleman de Luccia instabilities and other fundamental problems with vacua of the type of Bunch-Davies and many other are wonderfully summarized in "On the Limits of Effective Quantum Field Theory: Eternal Inflation, Landscapes, and Other Mythical Beasts.


*The inherent difficulty of having an always interacting thermal field theory in a compact space without boundary (absence of LSZ formula and a suitable definition of S-matrix elements).
There are many other problems. But I strongly want to emphasize that string theory is not the only paradigm apparently conspiring against the quantum existence of a de Sitter vacua. It's nearly all theoretical physics, from quantum mechanics, to general relativity, to fundamental principles (symmetries and unitarity), to basic quantum gravity expectations (like holography and extensions of black hole complementarity) that seems to be conspiring against the existence of de Sitter-like vacua. Even if someone refuses string theory, all the later problems are still there.
Do the arguments from above imply that we should reject quantum field theory and our basic assumptions about quantum gravity? Of course not! The apparent incompatibility of some particular models and general principles of quantum field theory and semi-classical quantum gravity against our observations cannot rule out the latter as paradigms; the same is true for string theory.
Even dark energy and inflation would be shown incompatible with the landscape. That does not imply that a universe cannot be described as an "excited" state that could decay into a landscape solution within string theory (see de Sitter Space as a Glauber-Sudarshan State and
Four-dimensional de Sitter space is a Glauber-Sudarshan state in string theory) in exactly the same way in which you can use quantum mechanics to describe the excited states of a system (not just its ground states).
A: Let me start by saying I am not a string theorist, so my answer is tentative. I largely agree with @matt_black. It looks to me that string theory is a – highly powerful – family of mathematical theories, not physical ones, at least not at the moment. Introducing new (unobservable) dimensions and a series of highly ingenious mathematical tools seem to have led to the result that almost any physical-looking equation can be derived. This surely is a mathematical tour de force, and it is possible that it may lead to physics at some point, but it seems to me that strong physical hypotheses have to be introduced that astronomically reduce the possible solutions. And it seems that for the moment no one has a clue what these physical assumptions are. One thing that often strikes me with string theory is, that some proponents claim that it is already a full theory of quantum gravity, while more modest physicists, even Nobel laureates as Gerard ‘t Hooft, are much more cautious and say that we are far away from a full theory of quantum gravity. See e.g. p. 13-14 in this article by ‘t Hooft:
https://iopscience.iop.org/article/10.1088/1742-6596/504/1/012003. Why such a different assessment? This seems an important question to me.
