Contradiction with Genesis 1:28
This verse speaks of God's blessing on humanity to be fruitful and multiply, while Genesis 38:6-10 involves Onan's refusal to fulfill his duty to his deceased brother by providing offspring for Tamar.
Genesis 1:28: And God blessed them, and God said unto them, Be fruitful, and multiply, and replenish the earth, and subdue it: and have dominion over the fish of the sea, and over the fowl of the air, and over every living thing that moveth upon the earth. [moveth: Heb. creepeth]
Contradiction with Deuteronomy 25:5-6
This passage outlines the levirate marriage law, ensuring a brother-in-law takes the widow as a wife to preserve the deceased brother's name, whereas Genesis 38:6-10 shows deviation from this duty, leading to God's displeasure.
Deuteronomy 25:5-6: If brethren dwell together, and one of them die, and have no child, the wife of the dead shall not marry without unto a stranger: her husband's brother shall go in unto her, and take her to him to wife, and perform the duty of an husband's brother unto her. [her husband's...: or, her next kinsman]