But you’re carrying something that is legal to carry, so why would a judge be involved ?
It’s perfectly plausible to find yourself in front of a judge for something legal. That’s literally what they’re there for, to decide whether you’ve acted legally or not and hand down a sentence accordingly.
It’s not a copper’s job to interpret the law, it’s their job to go “hmm, this looks dodgy” and haul you in for further investigation. Again, it’s why the knife law is the way it is, it’s so that your average plod can go “if X and/or Y then Z” and bring you in for the legal eagles to then deal with.