This verse is probably a maxim that James expected his readers to recognize.
Its source is unknown, but it is consistent with the teachings of Jesus. For example, in a parable about a faithful servant Jesus said: “And a servant who knows what the master wants, but isn’t prepared and doesn’t carry out those instructions, will be severely punished” (Luke 12:47).
We all know that it is sin to do what we know we should not do, but for Jesus’s followers it is also sin to know what we should do and not do it.
In other words, Jesus taught that sins of omission are just as egregious as sins of commission!
Both behaviors (or misbehaviors) are aspects of disobedience that apply to us, one just as much as the other.
It is disobedience to do what you know is wrong and it is disobedience not to do what you know is right!
Jesus holds His followers to a high standard of behavior: don’t do wrong things AND do right things!
“It would be better if they had never known the way to righteousness than to know it and then reject the command they were given to live a holy life. (2 Peter 2:21, NLT)