united-states civil-procedure
If a federal law caused a breach of contract, then how can the claim not need mention the federal law?
<p><sub>Source: pp 229-230, <em>Thinking Like a Lawyer: An Introduction to Legal Reasoning</em> (2010, 2 ed) by  Kenneth J. Vandevelde.</sub></p>

<blockquote>
  <p>  The statute granting federal question jurisdiction to the district courts
  has been limited by a judicially created rule known as the “well-pleaded
  complaint” rule.<sup>19</sup> Under this rule, the federal question must be a necessary
  part of the plaintiff ’s complaint. That is, a federal question raised by a defense
  does not bring the case within federal subject matter jurisdiction.<br>
    For example, assume that a retail store sues a manufacturer for breach of
  contract because the manufacturer failed to ship some toys that the retail
  store had ordered. The manufacturer raises as its sole defense the fact that
  after the order was placed, the federal government issued regulations banning this type of toy. Although the result in the case may well depend on an interpretation
  or application of the federal toy regulation, that federal law was
  raised as part of a defense and not as a necessary part of the plaintiff ’s claim.
  The plaintiff ’s claim was for breach of contract and <strong>could be set forth in its
  entirety without ever mentioning the toy regulation</strong>. Thus, under the well-pleaded
  complaint rule, the court probably would not have federal question
  jurisdiction over the retailer’s claim.</p>
  
  <p><sub><sup>19</sup> See <a href="https://en.wikipedia.org/wiki/Louisville_%26_Nashville_Railroad_Co._v._Mottley" rel="nofollow"><em>Louisville &amp; Nashville Railroad Company v. Mottley</em>, 211 U.S. 149 (1908)</a>. [OP: I have already read this case.]  </sub></p>
</blockquote>

<p>How is the bolded possible and realistic? Surely the plaintiff's counsel would expect and then anticipate the defendant's attempt to exculpate the defendant by deflecting all liability onto the federal government's law that bans the toys? Then:</p>

<ol>
<li><p>The plaintiff would have engaged federal law in his cause of action.</p></li>
<li><p>The plaintiff’s claim for breach of contract needs to mention the toy regulation. </p></li>
</ol>

<p>In simple terms, the only basis for the complaint is that the defendant did not ship the toys, not that the defendant violated federal law by their actions. No federal law mandates the shipping of toys, whether banned or unbanned.</p>

<p>Breach of contract is a state (common) law matter: the federal court doesn't have jurisdiction to hear the case.</p>
<p>The correct forum is the state court system because the cause of action alleged is entirely state based law: we have a contract and you have broken it.</p>
<p>You can certainly raise the defence of <em>impossibility</em> because a federal law prohibits you from complying with the terms of the contract and the <em>state</em> court can consider the merits of that defence. However, impossibility is a difficult bar to reach. For example, if the toys could be modified (even at high cost) to meet the Federal regulation, the contract is not impossible, just more expensive for the defendant to complain with.</p>

<p>To add to the correct statements made by the other answers, the well-pleaded complaint rule is actually even more extreme than the situation you present.</p>

<p>Suppose that a restaurant refuses to serve customers because they are black, in clear violation of federal civil rights statutes, and the customer refuses to leave. Then, the restaurant, knowing that it is about to be sued in federal court for a civil rights violation, brings a civil suit under state law seeking $1 of damages against the customer for trespassing on the theory that the customer didn't leave immediately when told that he wouldn't be served (a claim to which a federal law defense applies). The customer files a counterclaim for violation of his civil rights under the federal statute prohibiting racial discrimination in public accommodations.</p>

<p>Does this counterclaim asserting a claim for relief arising under federal law give a U.S. District Court subject-matter jurisdiction?</p>

<p>The answer is no. Under the well-pleaded complaint rule, not only federal law defenses, but federal law counterclaims are irrelevant and do not provide a basis for the removal of a case to federal court. Federal court jurisdiction is a matter in which the race to the courthouse can be outcome determinative.</p>
