I think you're looking for Plato's Theaetetus. Look for the metaphor of the aviary, maybe a third of the way down the dialog. The passage you're looking for may be this one:
SOCRATES: Then shall we say that about names we care nothing?—any one
may twist and turn the words 'knowing' and 'learning' in any way which
he likes, but since we have determined that the possession of
knowledge is not the having or using it, we do assert that a man
cannot not possess that which he possesses; and, therefore, in no case
can a man not know that which he knows, but he may get a false opinion
about it; for he may have the knowledge, not of this particular thing,
but of some other;—when the various numbers and forms of knowledge are
flying about in the aviary, and wishing to capture a certain sort of
knowledge out of the general store, he takes the wrong one by mistake,
that is to say, when he thought eleven to be twelve, he got hold of
the ring-dove which he had in his mind, when he wanted the pigeon.