Federal return (eFile) rejected because of mistake with claiming dependent.
He may still be on your ex-wife's return as a non-dependent. Certain tax benefits, such as the Earned Income Credit, Child and Dependent Care Credit, and Head of Household status, can only be claimed by the custodial parent (parent with who the child lived the most nights). So, while you can shift the dependency and child tax credit via an agreement, you CANNOT shift those credits (its also possible that the child may not be qualifying her for those credits but if she left him on her return, the same result would happen).
In these cases, the non-dependent's SSN must still be provided on the tax return and this causes the IRS e-file system to reject the other return with his SSN (your return). The only real way around this is to file your return by mail - once a SSN is locked in the system there is no way to remove it in time for filing this year.