As with many drug charges, your intention is always very important. If you were trying to make a legal substance but instead created an illegal one by mistake, then you should not be liable. You were not intending to break the law and only did so because of other circumstances. You did not manufacture that controlled substance with the intent of doing something illegal.