I’ve been hard on President Donald Trump during these onerous early months of his second term, but when he’s right, he’s right. In particular, his executive order on the reduction of “regulatory overcriminalization” pays welcome attention to a growing problem both parties have tended to ignore: the federal government’s race toward making everyone a felon.

Understand the point. Federal crimes are defined by Congress. Some are spelled out in the US Code. Most aren’t. Instead, they’re the result of rules adopted by federal agencies, which fill in the details themselves. Sounds reasonable, right? And it wouldn’t be a bad idea ... if there weren’t too many such administratively created rules and they were easy to find.

That’s not the case.

I asked o3 how many federal crimes exist. The AI threw up its hands. The response included a nice bit on why the government itself “can’t give you a crisp figure”: “Federal crimes are not gathered in a single ‘criminal code.’ They are scattered throughout all 54 titles of the U.S. Code and in the Code of Federal Regulations.”

It’s not just our swiftly burgeoning AIs that have no idea how many federal crimes there are. The government also admits not knowing. (The executive order asks the agencies to count the number of crimes created by their regulations. Perhaps in recognition of the challenge, the agencies are given a year to comply.)

That’s a problem. Congress, in its wisdom, has delegated to countless administrative agencies the authority to issue regulations that carry criminal penalties.

Often, the authority is as obscure as the rules adopted to enforce it. (Try figuring out why mattresses have those do-not-remove tags.) If the agencies themselves don’t know, one wonders what the unfortunate citizen is to do.

Like the unfortunate dog-lover who walks his pet on federal property, a much-mocked regulatory prohibition that is still on the books. Or the unfortunate seller of fish who truthfully labels her wares as inspected and passed by the US Department of Agriculture but uses a hand stamp rather than a machine to imprint that truth. Chances are, as the legal scholar Douglas Husak has argued, that we’re all felons.

To be sure, the impossibility of enumerating all criminal laws is not limited to those that are buried in the 175,000 pages of the Code of Federal Regulations. Nobody seems to know how many criminal laws are on the federal statute books either — not least because, contrary to common sense and human decency, they aren’t all collected in one place.

A 2022 study by the Mercatus Center used an algorithm to search the US Code for 12 specific text strings (“imprisonment for not more than” is typical) and found 5,199 statutory crimes, but there’s general agreement that this is an undercount. As for crimes created by federal agencies, nobody knows, but most estimates start at around 300,000 and range upward. Trump’s executive order commands that prosecutions under these agency-created rules be limited mostly to those who knew what they were doing was illegal. This proviso, says the order, is intended to “ensure no American is transformed into a criminal for violating a regulation they have no reason to know exists.”

In that sense, the proposition the order embraces makes a more general point about good government: Public servants ought not, through the numerousness and complexity of their statutes and regulations, make criminals of ordinary folk. Neat platitudes like “nobody is above the law” and “ignorance of the law is no excuse” are arrant nonsense in a world where even the legislators don’t know — and, evidently, make no effort to keep track of — what exactly they have and haven’t outlawed.

That nobody knows exactly what’s illegal is no trivial proposition. Let’s not forget that even laws over which we enthuse strip away freedom.

That’s not a reason to have no laws. It is a reason legislators charged with deciding what to criminalize should act cautiously and humbly. Imposing a fine or prison term doesn’t just mean showing your constituents how deeply you care about the latest hot issue. As I often remind my students, those who break the law — any law — face potential arrest by armed officers who, if the target resists, might kill them.

As I’ve argued before, public servants who refuse to face this consequence of our reckless taste for criminalization shouldn’t be public servants.

What can be done, beyond the shaky first step of Trump’s order? Maybe, as some have suggested, every criminal law, from treason and murder to disturbing mud in a federal park, should have an automatic sunset and require a separate reauthorization vote so that Congress can’t readopt the whole mess en masse. Maybe, as Trump’s order suggests, crimes created by regulatory fiat should be punishable only if the prosecutors can show that the defendant had actual knowledge that the conduct in question was criminal. Maybe we should just do what the founding generation surely expected, and limit federal crimes to those enacted by Congress — and not allow the agencies, under their delegated power, to determine what those crimes consist of.

Don’t get me wrong. I don’t blame the regulators. They’re just doing what the legislators have asked them to. Meanwhile, the federal agencies have their work cut out for them. Not only can they enforce far fewer of their own criminal rules than they could, say, a month ago. The order also requires each of them, within a year, to compile a list of every criminal offense within its jurisdiction.

Alas, the executive order does not go as far as my libertarian soul would prefer. In particular, the text specifically excludes enforcement of “immigration laws or regulations promulgated to implement such laws” and “laws or regulations related to national security or defense.”

This carve-out for the president’s own regulatory priorities is, to say the least, unfortunate. The result will be that all the order’s excellent talk about notice and knowledge is irrelevant in the arenas where the administration places its own enforcement priorities. Yet it is precisely where the government plans to concentrate resources that we should be most cautious about applying the criminal sanction.

Nevertheless, one has to begin somewhere. So, although I find much that Trump is doing bewildering or even scary, let’s cheer this tiny corner of optimism in a stressful time.

This column reflects the personal views of the author and does not necessarily reflect the opinion of the editorial board or Bloomberg LP and its owners.

Stephen L. Carter is a Bloomberg Opinion columnist, a professor of law at Yale University and author of “Invisible: The Story of the Black Woman Lawyer Who Took Down America’s Most Powerful Mobster.”