#17262·kit

RF query does not handle error or redirect when called from browser

Author: jdgamble555Created Sep 29, 2026Updated Oct 1, 2026

Describe the bug

If I call a RF on first load, and that RF has error() or redirect() in it, it will show error page or redirect as expect, because it is loaded from the server.

svelte
<script lang="ts">
  import { setGuard } from "../guard.remote";

  await setGuard();
</script>

<h1 class="mb-4 text-4xl font-semibold sm:text-5xl">Secret</h1>
<p class="text-xl leading-8 text-neutral-600">
  This is a secret page. You should not be able to access it. Refresh to see
  proper error message.
</p>

However, when you navigate to this page, it does NOT work as expected. It will show the data, when it shouldn't.

Reproduction

https://github.com/jdgamble555/sveltekit-auth-guard-test

https://sveltekit-auth-guard-test.vercel.app/

The change redirect page works, then it doesn't, not rhyme or reason to it, while the secret page only works on first load, not when you navigate to it.

Logs

bash

System Info

bash
"@sveltejs/kit": "^2.63.0",

Severity

serious, but I can work around it

Additional Information

Related to: https://github.com/sveltejs/kit/issues/15462

The obvious work around is to use +page.server.ts for a router guard, but that defeats the purpose of using remote functions.

Also, from my understanding this used to work as expected many versions back.