TL;DR: Shabda pramana is infallible insofar as it does not contradict perception or inference, and comes from a trustworthy authority. If shabda contradicts perception or inference, then believe in the perception or inference. Or take a look at this Hinduism stack exchange answer.
First, let's delineate what the valid means of knowledge (pramana) are. There are 3 pramanas:
- Perception (pratyaksha)
- Inference (anumana)
- Word (shabda)
Other pramamanas like anupalabdhi (proof of non-existence by non-perception), upamana (comparison/analogy), etc. can be reduced to anumana. Tradition, testimony of trustworthy authorities, eternal word (veda/shruti) are all reducible to shabda. Yogic powers is reducible to pratyaksha.
Now, the idea that shabda is more authoritative than perception because perception is prone to error, is a fallacious line of thinking, as will be demonstrated, and is held by Gaudiya Vaishnavas and partly by Advaitins (and probably others I don't know). The Sri Vaishnava sect and Purva Mimamsa sect (and probably others) acknowledge that perception is more authoritative than shabda.
The epistemic hierarchy is this: perception > inference > word. This is because word and inference presuppose that your perception is correct.
Shabda is word that is heard or seen using your senses, it means that your senses have to apprehend the shabda correctly. So, shabda presupposes that perception is correct, and so perception is stronger.
Inference is an invariable concomitance between perceived cause and perceived effect, such that when you see just the cause or just the effect, you can infer the other.
The misconstrued idea of infallibility of shabda is refuted by Shankaracharya in his Gita Bhashya:
The appeal to the infallibility of the Vedic injunction is
misconceived. The infallibility in question refers only to the unseen
forces or apurva, and is admissible only in regards to matters not
confined to the sphere of direct perceptions, etc. ..... Even a
hundred statements of sruti to the effect that fire is cold and
non-luminous won't prove valid [because no one can cognise what contradicts perception]. If it does make such a statement, its
import will have to be interpreted differently. Otherwise, validity
won't attach to it. Nothing in conflict with the means of valid
cognition or with its own statements may be imputed to sruti.
What this means is that Shabda is only authoritative when it does not conflict pratyaksha or anumana.
Ramanujacharya also mentions this in his Sri Bhashya section titled:
In cases of Scripture conflicting with Perception, Scripture is not
stronger.....
In which he says:
With reference to the assertion that Perception, which
depends on the view of plurality, is based on some defect and hence
admits of being otherwise accounted for--whence it follows that it is
sublated by Scripture; we ask you to point out what defect it is on
which Perception is based and may hence be accounted for otherwise.--'
The beginningless imagination of difference' we expect you to
reply.--But, we ask in return, have you then come to know by some
other means that this beginningless imagination of difference, acting
in a manner analogous to that of certain defects of vision, is really
the cause of an altogether perverse view of things?--If you reply that
this is known just from the fact that Perception is in conflict with
Scripture, we point out that you are reasoning in a circle: you prove
the defectiveness of the imagination of plurality through the fact
that Scripture tells us about a substance devoid of all difference;
and at the same time you prove the latter point through the former. Moreover, if Perception gives rise to perverse cognition because it is based on the imagination of plurality, Scripture also is in no better case--for it is based on the very same view.
Now you say:
A person after witnessing something may lie that he had seen some
other thing. For example after I saw two birds, I am lying to other
person that I actually saw only one.
This is a case of shabda pramana, since you are relying on the testimony of a person.
He may be in illusion, so there are possibilities that he might have
misunderstood the perceived object. For example, due to lack of light
a person is thinking rope is actually a snake.'
He may be, but unless there is reason to think he was in illusion, then you accept his testimony if he is trustworthy.
Also, unless you think your perception was illusory, or it was sublated by a stronger perception, then you accept it as valid.
Now you bring up a good point:
Even Arya Samajis inserted some verse in the Vedas containing killing
infidels. Even I can distort the swaras in Vedas while teaching Vedas
to my students. Doesn't this mean Sabda Pramana is also fallible and
prone to error?
Shabda pramana can be divided into two groups: authored word of trustworthy authorities and unauthored word. Unauthored word is the shruti or Veda, whereas authored word is the Smriti and other works.
When we learn the Vedas from an Acharya, we have trust in him since he is a trustworthy authority and accept the letters and swaras as is.
It is true that you can modify the swaras and letters of the Vedas, but unless you have evidence of tempering or distortions, and unless the shabda conflicts perception or inference, then you accept the shabda as valid. And the same reasoning goes for perception and inference; if you find the perception is sublated or mistaken, then you discard it. If you find the inference is fallacious or sublated by perception, then you discard it.