Common n8n Expression Mistakes and How to Fix Them
Stop your n8n workflows from failing by avoiding these three common expression errors. Learn how to handle dynamic data like a pro.
The Problem with Static Workflows
Most people start their automation journey by dragging nodes and filling in static text. It works perfectly for a few minutes. You feel like a genius because your first test run succeeded. Then the real data hits your workflow. Suddenly everything breaks. Your database is full of empty strings. Your Slack notifications are literal code snippets instead of names. You are seeing the word undefined everywhere.
This happens because your workflow is static. It is doing exactly what you told it to do. It is not reacting to the information flowing through it. To build real AI automation systems that make money, you have to move past static text. You have to master expressions.
Expressions are what allow your n8n workflows to stop being rigid. They start reacting to real data in real time. But there are three specific traps that catch almost every beginner. If you can avoid these, you will save yourself hours of debugging. The full walkthrough of these concepts is in the video above, but let us break down the mechanics here.
Mistake 1: The Expression Toggle Trap
The most common mistake happens before you even finish typing. In n8n, every input field has two modes. One is Fixed and the other is Expression. By default, most fields start in Fixed mode. This means n8n takes exactly what you type and treats it as a simple string of text.
If you type $json.name into a field that is still set to Fixed mode, n8n does not see that as a variable. It does not look for a name in your data. It literally sends the characters $json.name to the next step. If you are sending an email, your recipient will see that code instead of their actual name.
You must always check that toggle. It is a small button located at the top right of the input field. When you switch to Expression mode, the background of the field usually changes slightly. This tells n8n to evaluate what is inside. It treats your text as code rather than a label. Always look for that green indicator or the specific toggle state before you hit save.
Mistake 2: Case Sensitivity and Typo Errors
JSON field names are extremely picky. They are case sensitive. This is a fundamental rule of JavaScript that n8n follows strictly. If your incoming data has a field called name with a lowercase n, you cannot access it using Name with an uppercase N.
This sounds simple. In practice, it causes massive headaches. Many APIs return data with inconsistent casing. One might use camelCase while another uses PascalCase. If your expression returns undefined or errors out, the casing is the first thing you should check.
- Look at the Output panel on the left side of your screen.
- Find the exact field you want to use.
- Look at the spelling and the capitalization.
- Copy the field name directly from the output panel.
Do not try to type it out from memory. One tiny typo or one misplaced capital letter will break the entire logic of your node. If you copy it directly from the data preview, you eliminate the risk of human error.
Mistake 3: Accessing Nested Data Without Chaining
Data in n8n is rarely flat. It is usually nested. You might have an object called company. Inside that company object, you might have a field called name. Beginners often try to access the name by just typing $json.company.
When you do this, n8n does not give you the name. It gives you the entire company object. This looks like a mess of curly braces and key value pairs. If you try to send this to a spreadsheet, the spreadsheet will likely show a generic Object message. It will not show the company name you were looking for.
You have to drill down to the exact level of data you need. This is called chaining. You use dots to connect the levels. To get the name inside the company, you must use $json.company.name.
Always look at the structure of your data in the result preview. If you see brackets or braces around your data, you are likely looking at an object or an array. You need to go one level deeper. Keep adding dots until you see the specific string or number that you actually want to use in your workflow.
Understanding the Core Syntax
To write successful expressions, you need to understand the basic syntax. In n8n, expressions are wrapped in double curly braces. Everything inside those braces is JavaScript. This is why expressions are so powerful. You are not just limited to moving data. You can manipulate it.
There are three key variables you will use most of the time.
- $json is for the current item passing through the node. This is your primary tool.
- $node is for referencing data from a specific named node earlier in your workflow.
- $items is for indexed access when you need to look across multiple items at once.
When you combine these variables with the correct chaining and the right toggle mode, your workflows become dynamic. They can handle different names, different prices, and different dates without any manual intervention. This is the shift from a workflow that kind of works to a workflow that actually runs in production.
How to Debug Your Expressions
The best part about the n8n expression editor is the preview window. When you open the expression editor, you can see the Result at the bottom. If that result says [undefined], your expression is wrong. Do not close the window and hope it works during the execution. It will not.
Use that preview to test your logic. If you are trying to chain nested data, watch the preview as you add each dot. You should see the data transform from a complex object into a simple value. If the preview shows exactly what you want to see, then your expression is ready for the real world.
Building these systems in public means showing the mistakes as well as the successes. These three errors represent the majority of support tickets and forum posts from new users. Once you internalize the importance of the toggle, the casing, and the nesting, you are ahead of most people starting with automation.
What is the most frustrating error message you have run into while building your n8n workflows?
Want more from Selwyn Builds?
New videos become articles here automatically. Join the community to talk about them.