An obvious example in the U.S. is that even if you have a contract saying you have to work for someone for no pay, forever, with no possibility of getting out the contract, it would be unenforceable because we, as a nation, have decided that slavery should not be legal.
It turns out, many of these un-contractable issues involve the employer/employee relationship... another example: even if you sign a contract saying your employer doesn't have to pay you overtime, that provision would be thrown out if you challenged it, and would probably get the employer in trouble with various agencies, including the IRS.
I am a lawyer, but I don't have experience in this field, and this is not legal advice (you have to hire me for that), but this issue seems like one that a court (depending on the state, no doubt) would find that it doesn't matter what the contract says, an employer can't own everything an employee does.
To emphasize: this is NOT legal advice, don't rely on it, and you really should seek counsel if you are encountering this issue in real life.
The fact that the employer/employee relationship is so carefully controlled (specifically to limit the power the employer wields over the employee outside employment) is what makes me suspect that at least some jurisdictions would decline to enforce an employment contract provision that gave the employer ownership over all IP the employee produces, even if the IP is produced off-hours, without use of the employer's equipment, and not having any relationship to the employer's business.
Again, I don't actually know for sure - I'm not an expert in this area of law. But I think there is enough evidence in the rest of (U.S.) employment law jurisprudence to indicate that it's not open-and-shut in favor of the employer.
At issue is he says that what he created is within the realm/market of his employer. That would be akin to an Intel engineer saying "I designed another microchip for computers but I promise I was doing this for me and not for Intel so its mine." You cant do some work on specific sector A for your employer and then do some other work in specific sector A on your own and now expect the employer to ask, justifiably, "who decided the dividing line here?"
My apologies, I was responding to the question about why a court would find an employment contract provision unenforceable - we don't know what the OP's employment contract states (or if he even has one), so I was treating this whole line of inquiry as separate from the OP's situation. Didn't mean to confuse the issues.
Some states (don't know in USA, speaking from EU) have laws against "unfair clauses" which make those automatically null even if you accept it. Usally the point is that for each clause in a contract which put an obligation on the employee, the employer must "give something back" to repay for that obligation in equal terms.
In this case in my state the employer should at least have paid for all the time out-of-work in which op worked on his IP, and with a rate established by op
Contracts state a lot of things that don't necessarily hold up. It's just words on paper. Sometimes they're even tenable in one area, then used in another state which disallows some claim or another.
Employment contracts in particular are subject to a lot of restrictions and protections regardless of what the employer makes people sign, because labor laws.
Depends on where you are. In the EU, parts of contracts that sre against the law, which includes labor without payment, are invalid and you are free to sign it.
In this case, giving up IP you made in your free time requires a new contract, because the law also requires a purchasing contract to have clear parameters
Please don't make comments like this, particularly in threads where OP is probably misunderstanding their legal situation and about to be extremely disappointed.
It is absolutely routine for employment contracts for software developers to transfer the corresponding IP to the employer. It's the main asset the employee is being hired to create!
It is common in fair and reasonable employment contracts for the standard for what is covered to be something like anything done on work time, using work resources, or related to work activities. The legalese varies from place to place, but if the employment contract includes wording like "in the course of your employment" then it probably means something along these lines, again depending on your local laws.
Some employers do try to include much more wide-ranging grabs, potentially any IP created by a salaried employee during the period of their employment. I normally recommend against signing any contract that includes these, not least because it says something about what type of employer you're dealing with. It's true that the situation is less clear in this case, because in some jurisdictions such terms might be considered overly broad and so not stand up to challenge, but you really need a local lawyer to advise you about this because the rules vary widely from place to place. In any case, since OP has told us that the project in question is directly related to what they do at work, this aspect probably isn't relevant to today's discussion.
OP, I'm sorry to be the bearer of bad news, but unless there are important details you've omitted or your employment contract is unusually liberal, you probably don't have much of a leg to stand on here. It's quite likely that your employer has actually owned all of the relevant IP from day one.
That would probably mean you wouldn't be entitled to any sort of compensation for it. (This isn't to say that your employer might not offer something to maintain good will and keep you on-side, but that's a different matter.)
More than that, it would potentially also mean you never had any legal right to open source it yourself, if the copyright was never yours so you never had any power to license it. That in turn could mean anyone redistributing it has been infringing your employer's copyright all along and the employer could even sue them. The employer could also take the whole project back closed source, or do anything else legal they want to do with it. (Again, this isn't to say they will actually do any of these things, but the employer being nicer than the worst case isn't a problem.)
On top of all of that, if the project is in any way in competition with what you do at work, you may have violated other conditions of your employment, which as with so much of this stuff may end up changing nothing or could have quite profound implications.
Short version: You do need a local lawyer who works in this field, right now. They will help you to understand your real situation, which no-one here can do properly. They may well advise you to simply hand everything over, and perhaps to seek some sort of written confirmation from the employer that they don't consider you to have violated any other aspects of your employment contract and the matter is then settled. If your employer is into open source and sees the value in the community you've built, you might get away with that. On the other hand, if they're sufficiently aware and litigious to go after your project in the first place, things could be much worse, and then you definitely want to have proper advice before you do or say anything else.