// guides · n8n error index

n8n Rename Keys node not working: silent no-ops, lost fields and regex, 28 runs

Fix the n8n Rename Keys node: a key that stays the same with a green run (case, a trailing space, a CSV BOM), dots that move values into or out of objects, renames that overwrite or lose a field, and regex that only replaces the first match. 28 real runs on n8n 2.43.7.

Updated 2026-10-24 · about 10 minutes

Still stuck after these steps? Paste your exact n8n error and we'll reproduce it and email you the fix, free →

Steps

  1. A green run that renamed nothing: the Current Key must match exactly

    When Current Key does not match, Rename Keys does nothing and still shows a green run. In our runs first name on a field called First Name did nothing (case counts), email with a trailing space did nothing, and an empty New Key left the field as it was. Accented keys work if typed exactly: Prénom to prenom worked. Copy the key from the input data instead of typing it.

  2. CSV with a BOM: the first key has an invisible character

    A CSV saved with a BOM gives the first column a key that starts with an invisible \ufeff character. Current Key name on that key did nothing, with a green run. Fix it where the file is read: see the BOM part of n8n Extract From File (CSV) not working. To see the real key names, you can put {{ JSON.stringify(Object.keys($json)) }} in an Edit Fields value (we did not run this check).

  3. Dots in a key are paths, not plain text

    Current Key user.name on {"user":{"name":"Ann","age":3}} moved the value out of the object: the result was {"user":{"age":3},"name":"Ann"}. A dot in New Key does the opposite: email to contact.email gave {"contact":{"email":"a@x.io"}}. A flat key that really is called user.name was renamed too. Array paths work the same way: items[0].sku to sku moved the value out and left "items":[{}], an empty object, behind.

  4. Renaming to a key that already exists overwrites it

    Renaming email to id on an item that already had id: 1 gave {"First Name":"Ann","id":"a@x.io"}. The old id was gone and there was no warning. Check that the New Key is not already used, or rename the existing field first in a separate node.

  5. Swapping two keys loses a value, and pairs do not chain

    Two pairs a to b and b to a on {"a":1,"b":2} gave {"a":2}: the value 1 was lost, with a green run. Two pairs a to b and b to c on {"a":1} gave {"b":1}: the second pair did not see the key the first pair had just created. Each pair reads the keys of the input item, not the result of the pair before it. So a swap through a temporary key will probably also fail inside one node; use two Rename Keys nodes or an Edit Fields node instead (we did not run either fix).

  6. The renamed key moves to the end of the item

    Renamed keys are added at the end. {"a":1,"b":2,"c":3} with b renamed to z gave {"a":1,"c":3,"z":2}, and First Name renamed to first_name ended up after email and id. Values do not change, but column order in a CSV, Google Sheets or table built from these items will. If order matters, set the fields in the order you want with Edit Fields.

  7. Regex replaces only the first match in each key

    The Regex option (Add option, Regex) is not global. Search (a space) with Replace With _ turned Zip Code Here into Zip_Code Here, and \s+ gave the same result. [A-Z] to x turned FirstName into xirstName. To replace every space, add the same replacement once per space, or rename the keys in a Code node with replaceAll (we did not run the Code node version). Other regex results: Case Insensitive made ^name$ match NAME; capture groups work, ^(\w+) (\w+)$ to $2_$1 gave Name_First; nested keys were renamed too (user.name became user.nm), with the default depth and with depth -1. An invalid pattern such as (unclosed fails the node with Invalid regular expression: /(unclosed/: Unterminated group.

  8. Key pairs run before the regex, and expressions work

    With both a key pair and a regex, the pair ran first: First Name to first by the pair, then Last Name to Last_Name by the regex. Expressions work in Current Key: {{ 'email' }} renamed email, and {{ Object.keys($json)[0] }} renamed the first key of each item. Items without the key pass through unchanged, a key whose value is null is still renamed, and an empty item {} passes through as {}. Google Sheets style headers such as Email Address and Phone Number renamed fine, and row_number was kept.

What we ran

On 24 October 2026 we ran 28 executions of the Rename Keys node v1 on self-hosted n8n 2.43.7 with n8n execute: a Manual Trigger, a Code node with test items, the Rename Keys node and a Code node that recorded the output. 27 runs succeeded and 1 failed. Every value below is copied from those runs.

SetupResult
First Name to first_nameRenamed, moved to the end: {"email","id","first_name"}
Current Key first name (wrong case)Green run, nothing renamed
Current Key email (trailing space)Green run, nothing renamed
user.name to name on nested user{"user":{"age":3},"name":"Ann"}
user.name to name on a flat key "user.name"{"name":"Ann"}
email to id, id already existsOld id overwritten: {"First Name":"Ann","id":"a@x.io"}
Swap: a to b, b to a on {"a":1,"b":2}Green run, value lost: {"a":2}
Chain: a to b, b to c on {"a":1}{"b":1}, second pair skipped
email to contact.email{"contact":{"email":"a@x.io"}}
Empty New KeyGreen run, nothing renamed
Current Key expression {{ 'email' }}Renamed
Current Key expression {{ Object.keys($json)[0] }}First key renamed
Regex space to _First_Name, Last_Name, Zip_Code Here
Regex \s+ to _Zip_Code Here (first match only)
Regex ^name$, Case Insensitive, on NAMEfull_name
Regex name to nm, default depthTop-level and nested keys renamed
Same, depth -1Same result
Regex ^(\w+) (\w+)$ to $2_$1Name_First
Regex (unclosedError: Invalid regular expression: /(unclosed/: Unterminated group
Regex [A-Z] to x on FirstNamexirstName (first match only)
3 items, one without the key, one with nullMissing key unchanged, null renamed
items[0].sku to sku{"items":[{}],"sku":"A1"}
Email Address, Phone Number plus row_numberRenamed, row_number kept (now first)
b to z on {"a":1,"b":2,"c":3}{"a":1,"c":3,"z":2}
Prénom to prenomRenamed
name on a key with a BOM (\ufeffname)Green run, nothing renamed
Key pair plus regex space to _Pair first: first, then Last_Name
Empty item {}{}

Quick checklist

Good to know

What we didn't test

FAQ

Why does the n8n Rename Keys node not rename my field?

The Current Key does not match the input key exactly. In our runs a case difference, a trailing space, a CSV BOM on the first key and an empty New Key all left the field unchanged with a green run.

How do I rename a nested field with n8n Rename Keys?

Use dot notation. user.name as Current Key moves the value out of user to the top level, and a dot in New Key, such as contact.email, creates a nested object.

Why did a field disappear after Rename Keys?

Renaming to a key that already exists overwrites it without a warning, and swapping two keys in one node lost one value in our runs.

How do I replace all spaces in key names in n8n?

The Regex option in Rename Keys replaces only the first match per key, even with \s+. Add the replacement once per space, or use a Code node with replaceAll (we did not run the Code node version).

What does "Invalid regular expression: Unterminated group" mean in n8n Rename Keys?

The regex pattern has an opening bracket without a closing one, such as (unclosed. Close the group or escape the bracket as \(.

Why did Rename Keys change the order of my columns?

Renamed keys are added at the end of each item. Values stay the same; use Edit Fields if you need a fixed column order.

Related guides

New guides

Still stuck on your n8n error?

Paste the exact error and say what the workflow should do. We reproduce it on a real n8n install and email you the fix or a working workflow, usually within 24h. Free while we're in beta.

We'll only email you about your error and TaskToAgent.