Skip to content

error called within load functions trigger a "preloading data error" #15425

Closed

Description

@WarningImHack3r

Describe the bug

When triggering a 404 in a load function (in my case, from the server), I correctly get a 404 page. However, 2 unexpected things happen:

  • I get a "Preloading data for failed" warning
  • my handleError client hook (not server) receives a 500 error

Errors or redirects manually and intentionally sent should not be considered as preloading errors, and only gracefully serve the desired error page

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-hscssi9h?file=src%2Froutes%2Fabout%2F%2Bpage.server.js

Click the "About" tab after opening the browser's console

Logs

// when logging \`${JSON.stringify({ error, status, event, message })}\` in my `handleError`
{
	"error": {
		"type": "error",
		"error": {
			... // second arg of my `error(404, { ... })` call
		},
		"status": 404 // accurate
	},
	"status": 500, // unexpected
	"event": {
		"params": { ... },
		"url": "...",
		"route": {
			"id": "..."
		}
	},
	"message": "Internal Error" // unexpected
}

---
// the other warning I get at the same time

Preloading data for /pull/vercel/nft/568 failed with the following error: Internal Error
If this error is transient, you can ignore it. Otherwise, consider disabling preloading for this route. This route was preloaded due to a data-sveltekit-preload-data attribute. See https://svelte.dev/docs/kit/link-options for more info

System Info

System:
    OS: macOS 26.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.42 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 25.6.1 - /opt/homebrew/bin/node
    npm: 11.10.1 - /opt/homebrew/bin/npm
    pnpm: 10.30.1 - /opt/homebrew/bin/pnpm
    bun: 1.3.9 - /Users/antoine/.bun/bin/bun
    Deno: 2.6.10 - /opt/homebrew/bin/deno
  Browsers:
    Chrome: 137.0.7151.120
    Firefox: 145.0.1
    Safari: 26.3
    Safari Technology Preview: 26.0
  npmPackages:
    @sveltejs/adapter-vercel: ^6.3.2 => 6.3.2
    @sveltejs/kit: ^2.53.0 => 2.53.0
    svelte: ^5.53.1 => 5.53.1
    vite: ^7.3.1 => 7.3.1

Severity

annoyance

Additional Information

No response

Activity

  1. added theissue type on Jul 1, 2026
  2. added
    bugSomething isn't working
    and removed
    bugSomething isn't working
    on Aug 4, 2026
  3. Nic-Polumeyv commented on Aug 12, 2026

    @Nic-Polumeyv
    Member

    Fixed on version-3. Since #12579 the client handleError hook is skipped for server load errors, and universal load errors reach it with their real status. Same bug as #16456, where a 2.x backport was declined. The dev warning still fires, now with the real message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions