kit icon indicating copy to clipboard operation
kit copied to clipboard

Error when using hyphenated keys in object properties with Remote functions form

Open shamokit opened this issue 3 weeks ago • 4 comments

Describe the bug

When using Remote functions with the form API, object keys containing hyphens (e.g., zh-TW, zh-CN) cause errors when accessing form fields.

Reproduction

https://github.com/shamokit/sveltekit-hyphen-case-form-error

Run pnpm dev and click the submit button on the form.

Logs

Uncaught (in promise) Error: Invalid path list[0].text.zh-TW

System Info

System:
    OS: macOS 15.6.1
    CPU: (12) arm64 Apple M4 Pro
    Memory: 2.52 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.16.0 - /usr/local/bin/node
    npm: 11.4.1 - /usr/local/bin/npm
    pnpm: 10.12.1 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 142.0.7444.176
    Safari: 18.6
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.0 => 7.0.0 
    @sveltejs/kit: ^2.49.1 => 2.49.1 
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1 
    svelte: ^5.45.5 => 5.45.5 
    vite: ^7.2.6 => 7.2.6

Severity

annoyance

Additional Information

No response

shamokit avatar Dec 05 '25 08:12 shamokit

Why would you want hyphens in the name?

dummdidumm avatar Dec 05 '25 09:12 dummdidumm

Related to #14567. Is this error message from validation that was added to avoid the errors that were seen in that issue?

Conduitry avatar Dec 05 '25 10:12 Conduitry

We are operating a multilingual site and need to store values separately for each language. The language keys are already in hyphen-case, and we would prefer not to change them.

I wasn't aware of that issue.

shamokit avatar Dec 05 '25 10:12 shamokit

If it is by design that hyphen-case cannot be used for keys, I’m thinking of closing this issue. Just to confirm, is this a specification rather than a bug?

shamokit avatar Dec 05 '25 10:12 shamokit