nobodywashere: Which browser are you using?
"I'm using Safari 18.5 on Mac Os Sequoia 15.5. I have Safari set to use Ecosia for search and I'm redirecting to Kagi using StopTheMadness."
RoxyRoxyRoxy: I'm unable to replicate this, and I don't believe we have a bang for Gmail by default. Can you confirm this isn't the result of a custom bang you've added?
Thanks for trying! I'll admit I am confused about what a "default" bang is, and how this is different than the ones that "just work", but Kagi Bang Explorer lists several for Gmail: https://kbe.smaertness.net/search?q=gmail.
I'm pretty sure it's not Custom Bang that I've set. When I go to Settings/Search/Advanced/Open Custom Bangs it shows me an empty page. This also wouldn't explain the difference in behavior from URL bar vs homepage.
I do wonder if it's somehow a Safari bug instead, but I'm surprised it would be affected by having it at the end of the search string instead of just the beginning. I have "Enable Quick Website Search" unchecked, but maybe Safari is someone ignoring this.
Searching now, I do discover that Ecosia (which I'm using as the "dummy" but have never actually used otherwise) does support "!gm" as a bang for Gmail: https://support.ecosia.org/article/22-shortcuts. I do wonder if somehow this might be defeating the admittedly janky redirect approach I'm using.
Yes, I think this it it! When I use one of other bangs that is supported by Ecosia, it also uses the Ecosia definition instead of the Kagi definition. It does this even if I enter the full URL directly instead of entering keywords. I'm guessing this is because of the interaction between the built-in Safari prefetch mechanism and the redirect system. I think if the prefetch gets a redirect from Ecosia, the redirect to Kagi never gets invoked, and the Kagi definition of the bang gets ignored.
I think this means you can close this as a Kagi bug. It's still a bug, but I don't think there is anything you can do to solve it at your end. The base problem is with Safari's inability to add custom search engines, which leads to the reliance on redirects, which leads to problems like this. From my side, I could probably solve it by choosing a dummy search engine that doesn't support bangs. I'll probably just live with it instead, and train myself to use "gmap" instead of "gm".