fix(locale): duplicate en-US key crashes boot under jsonv2 (#696/#728) #743
Reference in New Issue
Block a user
Delete Branch "fix/locale-dup-key-jsonv2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Second fresh-boot crash (after the code-scanner panic in #742)
With the code-scanner panic fixed, the dev container booted further but still crash-looped, now on:
The binary is
built with go1.26.4-X:jsonv2. Go 1.26's v2 JSON decoder rejects duplicate object keys; the old v1 decoder silently kept the last value.locale_en-US.jsonhadrepo.settings.event_deletetwice:"Delete", with itsevent_delete_descsibling), used bywebhook/settings.tmpl;"Branch Deletion"added by the branch-protection delete feature (#696/#728), used byprotected_branch.tmpl— it reused the existing key name.Under the old decoder the last value won (so the webhook label wrongly showed "Branch Deletion"); under jsonv2 it's fatal.
Fix
repo.settings.protect_branch_deletion("Branch Deletion") and pointtemplates/repo/settings/protected_branch.tmplat it. The webhook keepsevent_delete= "Delete". Both labels render correctly and the JSON has no duplicate.options/**/*.json(locale + fileicon) for duplicate keys — en-US was the only affected file; all now clean..moko-customization-baseline.jsonis valid.Only en-US had the duplicate; other locales fall back to en-US for the new key.
https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT
The branch-protection delete feature (#696/#728) added a second "repo.settings.event_delete" entry ("Branch Deletion") to locale_en-US.json, reusing the existing webhook-event key (value "Delete"). The old JSON decoder silently kept the last value; Go 1.26's jsonv2 decoder rejects duplicate object keys, so InitLocales fails ("duplicate object member name repo.settings.event_delete") and the server crash-loops at startup. Like the code-scanner regexp panic, this only surfaces on a fresh boot, which is why it shipped unnoticed. Give the branch-protection section header its own key "repo.settings.protect_branch_deletion" and point protected_branch.tmpl at it, so the webhook "Delete" label and the branch-protection "Branch Deletion" header both render correctly and the JSON has no duplicate. Verified: no duplicate keys remain in any options/locale/*.json. Claude-Session: https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT