sveltejs / sveltejs/kit

Form remote function broken if a field name contains dashes

Open Beginner friendly
#14,801 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

forms
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

A field name containing dashes like my-field-name causes the form submission to fail.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-form-dash-bug?file=src%2Froutes%2F%2Bpage.svelte

Logs
Uncaught (in promise) Error: Invalid path field-with-dash
    at split_path (form-utils.js?v=f53a3d90:74:9)
    at set_nested_value (form-utils.js?v=f53a3d90:22:19)
    at convert_formdata (form-utils.js?v=f53a3d90:61:3)
    at convert (form.svelte.js?v=f53a3d90:90:17)
    at handle_submit (form.svelte.js?v=f53a3d90:105:17)
    at HTMLFormElement.<anonymous> (form.svelte.js?v=f53a3d90:295:36)
System Info
System:
    OS: macOS 15.5
    CPU: (8) arm64 Apple M2
    Memory: 79.02 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    npm: 9.6.4 - /opt/homebrew/bin/npm
    pnpm: 10.18.3 - /opt/homebrew/bin/pnpm
    bun: 1.3.0 - ~/.bun/bin/bun
  Browsers:
    Chrome: 141.0.7390.108
    Safari: 18.5
  npmPackages:
    @sveltejs/adapter-auto: ^6.1.0 => 6.1.1
    @sveltejs/kit: ^2.43.2 => 2.47.3
    @sveltejs/vite-plugin-svelte: ^6.2.0 => 6.2.1
    svelte: ^5.39.5 => 5.41.4
    vite: ^7.1.7 => 7.1.12
Severity

annoyance

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the form-utils.js stack-trace entry points, especially split_path, set_nested_value, and convert_formdata, then reproduce the failure using the linked StackBlitz example with a dashed field name. Done means form submission succeeds for names such as my-field-name without the Invalid path error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.