Skip to content

Svelte 5 HMR Bug Report #17483

@k61b

Description

@k61b

Describe the bug

When running SvelteKit in development mode, performing a soft reload (Ctrl+R or clicking refresh) causes the following error:

TypeError: can't access property "call", first_child_getter is undefined
    get_first_child operations.js:89
    from_html template.js:71
    add_locations elements.js:15
    Root root.svelte:68
    effect2 hmr.js:50
    update_reaction runtime.js:260
    update_effect runtime.js:439
    create_effect effects.js:124
    branch effects.js:419
    wrapper hmr.js:41
    update_reaction runtime.js:260
    update_effect runtime.js:439
    create_effect effects.js:124
    block effects.js:396
    wrapper hmr.js:30
    unmount2 render.js:228
    ...

Hard reload (Ctrl+Shift+R) works fine. The error only occurs on soft reload.

Additionally, after this error occurs, the page becomes completely unresponsive - no interactions (clicks, inputs, etc.) work until a hard reload is performed.

Reproduction

  1. Create a new SvelteKit project with Svelte 5
  2. Run npm run dev
  3. Open the app in browser
  4. Press Ctrl+R (soft reload) or click the refresh button
  5. Error appears in console
  6. Try to interact with the page - nothing works

Expected behavior

Soft reload should work without errors, same as hard reload. The page should remain interactive after reload.

Environment

  • Svelte: 5.45.6
  • SvelteKit: 2.49.1
  • Vite: 7.2.6
  • Browser: Firefox (also happens in Chrome)
  • OS: macOS

Workaround

Setting hmr: false in vite.config.ts prevents the error but disables HMR entirely:

// vite.config.ts
export default defineConfig({
  server: {
    hmr: false
  }
});

Additional context

Reproduction

Reproduction: Working on creating a minimal reproduction.
The issue occurs in a SvelteKit project using Svelte 5, Melt UI, and Paraglide.

Logs

System Info

System:
  OS: macOS 15.6.1
  CPU: (10) arm64 Apple M2 Pro
  Memory: 113.48 MB / 16.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 22.12.0
  npm: 11.6.2
  bun: 1.3.1
Browsers:
  Chrome: 143.0.7499.194
  Firefox: 146.0.1
  Safari: 18.6
npmPackages:
  @sveltejs/kit: 2.49.5
  svelte: 5.46.4
  vite: 7.3.1

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterneeds a reproduction, or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions