Aitareya Brahmana (7.13-18) describe the incident of Sage Vishwamitra cursing his sons. The story goes as follows:
Once upon a time there was a Brahmana named Ajigarta who had given his son Sunahsepa for sacrifice to king Harishchandra. At the time of sacrifice Sunahsepa praised gods including Prajapati, Agni, Varuna, Visve Devas, Indra etc and thus the gods saved his life. Sage Vishwamitra was also present there and he has accepted Sunahsepa as his son. Sage Vishwamitra had also hundred sons out of which first fifty sons doesn't accept Sunahsepa and hence cursed while the later fifty sons accepted Sunahsepa as their brother.
This Risi Visvamitra had a hundred sons, fifty of them were older than Madhuchhandas, and fifty were younger than he. The older ones were not pleased with (the installation of Sunahsepa to the primogeniture). VisvAmitra then pronounced against them the curse, " You shall have the lowest castes for your descendants." Therefore are many of the most degraded classes of men, the rabble for the most part, such as the Andhras, Pundras, Sabaras, Palindas, and Mutibas, descendants of Visvamitra. But Madhuchhandas, with the fifty younger sons, said,
" What our father approves of, by that we abide ; we all accord to thee (Sunahsepa) the first rank, and we will come after thee ! " Visvamitra, (leligated 'at this answer) then praised these sons with the following verses :
" Ye my sons will have abundance of cattle and children, for you have made me rich in children by consenting to my wish."
Srimada Bhagavatam 9.16 also narrates this story.
SB 9.16.29 — O King Parīkṣit, Viśvāmitra had 101 sons, of whom the middle one was known as Madhucchandā. In relation to him, all the other sons were celebrated as the Madhucchandās.
SB 9.16.30 — Viśvāmitra accepted the son of Ajīgarta known as Śunaḥśepha, who was born in the Bhṛgu dynasty and was also known as Devarāta, as one of his own sons. Viśvāmitra ordered his other sons to accept Śunaḥśepha as their eldest brother.
SB 9.16.31 — Śunaḥśepha’s father sold Śunaḥśepha to be sacrificed as a man-animal in the yajña of King Hariścandra. When Śunaḥśepha was brought into the sacrificial arena, he prayed to the demigods for release and was released by their mercy.
SB 9.16.32 — Although Śunaḥśepha was born in the Bhārgava dynasty, he was greatly advanced in spiritual life, and therefore the demigods involved in the sacrifice protected him. Consequently he was also celebrated as the descendant of Gādhi named Devarāta.
SB 9.16.33 — When requested by their father to accept Śunaḥśepha as the eldest son, the elder fifty of the Madhucchandās, the sons of Viśvāmitra, did not agree. Therefore Viśvāmitra, being angry, cursed them. “May all of you bad sons become mlecchas,” he said, “being opposed to the principles of Vedic culture.”
SB 9.16.34 — When the elder Madhucchandās were cursed, the younger fifty, along with Madhucchandā himself, approached their father and agreed to accept his proposal. “Dear father,” they said, “we shall abide by whatever arrangement you like.”
SB 9.16.35 — Thus the younger Madhucchandās accepted Śunaḥśepha as their eldest brother and told him, “We shall follow your orders.” Viśvāmitra then said to his obedient sons, “Because you have accepted Śunaḥśepha as your eldest brother, I am very satisfied. By accepting my order, you have made me a father of worthy sons, and therefore I bless all of you to become the fathers of sons also.”