Troubleshooting
Why the Node-RED FTP server node stays idle for scanner images
Short answer
The node reads IDLE because it is bound to the loopback address on port 2000, so the scanner's connection is refused before a session opens; IDLE itself is normal and never proves reachability. Bind the node to the PC's NIC address or all interfaces, fix the passive port range and credentials, and rebuild the file node to write one JPEG per message.

On this page
- Why does the ftp-server node show IDLE while the scanner cannot connect?
- Is ftp-server the right node, or does the flow need ftp in?
- What bind address and control port should the ftp-server node use?
- Which ports must Windows Firewall open for passive FTP?
- Why does login succeed but the image never reach the disk?
- How should the file node be set so each JPEG survives?
- How do you prove the whole path end to end?
- Questions asked
An ftp-server node reading IDLE is not proof of a working listener: IDLE is its normal status whenever the server is up and no client session is open, and it never changes when the bind is unreachable. In this flow the node is tied to the loopback address on port 2000, so the scanner's connection to the PC's LAN address is refused before any session exists. Fix the bind, pin the passive port range, store real credentials, and rebuild a file node that is currently set to paste every JPEG into one file. The sections below take the causes in the order the connection meets them.
Why does the ftp-server node show IDLE while the scanner cannot connect? #
IDLE is the node's normal state whenever the server is up and no client session is open; it is a status label, not a health check, so it reads IDLE forever while the listener is unreachable.
The node is configured with "ip": "127.0.0.1", and a socket bound to the loopback address accepts connections only from processes on the same host. The scanner sends its connection request to the PC's LAN address, no socket is listening there, the TCP stack answers with a reset, and the scanner reports a connection failure. Nothing appears in Node-RED because nothing ever arrives at it. This is the same loopback trap that keeps a broker client offline until it is pointed at a reachable address, as in why an MQTT sink stays offline until you use the broker IP address. The decision: change the bind before touching any other field.
Is ftp-server the right node, or does the flow need ftp in? #
Keep ftp-server: in the push topology the scanner is the FTP client, so Node-RED must be the server, while the ftp in node dials out and uploads from Node-RED — the wrong direction for collecting images.
Two independent conversations run through this flow and fail for different reasons. The trigger path opens a TCP session to the scanner at 192.168.1.50 on port 51240 and sends a T; that conversation only starts a scan. The image path is a separate connection: on a no-read the scanner acts as the FTP client, opening a control connection to whatever server address its image-saving parameters name, logging in, and issuing STOR. The ftp-server node exists to answer that. The ftp in node from the node-red-contrib-ftp package plays the opposite role: with operation put it connects to 192.168.1.75 on port 21 as Scanner.User and uploads from Node-RED to that host. Use it only in the other topology, where the scanner or a NAS runs the FTP daemon and Node-RED polls with list and then get. The decision: the scanner pushes, so keep ftp-server and unwire ftp in — one branch fully built instead of two half-built paths.
What bind address and control port should the ftp-server node use? #
Set ip to the PC's address on the scanner's subnet, or 0.0.0.0 to listen on every interface, and move the control port from 2000 up to 2121 — a high port no other service on the PC is likely to hold.
How each choice behaves with the scanner at 192.168.1.50:
ip value |
Accepts connections from | Result |
|---|---|---|
127.0.0.1 |
the Node-RED host only | connection refused at the scanner; node sits at IDLE |
| the host NIC address | that subnet | session establishes |
0.0.0.0 |
every host interface | session establishes, including on any second NIC or VPN adapter |
Binding every interface also exposes the listener wherever the PC routes, and plain FTP carries the password and the images unencrypted, so keep the server on the isolated scanner subnet and never forward the port past the OT network boundary.
Stay near 2121 unless the scanner forces you elsewhere, and do not drop into the well-known range: Hyper-V, WSL and Docker reserve blocks of TCP ports on Windows, and a bind inside a reserved block is refused without a useful error. Check before blaming the node:
netsh int ipv4 show excludedportrange protocol=tcp
The constraint can also run the other way. Many device-side FTP clients expose only server address, path, user and password, with the control port fixed at 21. Read the scanner's image-saving configuration; if it has no port field, run the server on 21 instead and stop any Windows FTP service from IIS already holding that port. The decision: the scanner's configuration decides the control port; the bind address is the part you choose.
Which ports must Windows Firewall open for passive FTP? #
Give passiveportrange a contiguous block, for example 2100-2110, and open exactly the control port plus that range inbound, because an empty field hands each transfer an arbitrary high port that no rule covers.
FTP, defined in RFC 959, carries commands on one TCP connection and file bytes on a second one, and that second connection is where half-configured servers die: the control session succeeds, the login succeeds, and the transfer stalls the moment the data channel opens. Enter the range in the format the node's help panel shows, then allow both in one rule:
New-NetFirewallRule -DisplayName "Node-RED FTP" -Direction Inbound -Protocol TCP -LocalPort 2121,2100-2110 -Action Allow
Sizing the range is simple arithmetic: the example block holds 2110 - 2100 + 1 = 11 ports, and one STOR occupies exactly one data port for its duration, so it supports 11 concurrent transfers. A single scanner uses one at a time, and that count leaves headroom for more devices while staying small enough for a single rule.
Which side opens the data connection is the client's choice: passive mode needs the range above, active mode needs the server to dial back to a port the scanner names. On one flat subnet either mode works; through a router or address translation, passive mode with the fixed range is the only one worth configuring. The decision: set the scanner to passive and open the range.
Why does login succeed but the image never reach the disk? #
A login that succeeds and then answers 550 on STOR points at two places: credentials that were never actually stored, or a server root directory the Windows account running Node-RED cannot write.
The export shows "credentials": {} because exports strip credentials; open the running node and read the real fields. Set an explicit user and password, then enter them on the scanner byte for byte including case — a login like Scanner.User, with a dot inside, is exactly the string that gets retyped wrong. Do not lean on anonymous access: embedded FTP clients frequently send a username regardless of what you configure.
Then the filesystem. The server's root directory must exist and be writable by the account Node-RED runs under. A path inside a user profile works while Node-RED is launched from that user's shell and fails the moment it runs as a service under a system account. Point the server at a directory outside any profile, for example C:\ScannerPhotos, and grant write to that service account. In a container, the same write fails as EACCES on mkdir until the directory is a host-mounted path, covered in Node-RED Docker EACCES mkdir: write to host storage, not container. The decision: a good login followed by 550 is a filesystem permission problem, not a network one.
How should the file node be set so each JPEG survives? #
Clear the Filename field so the node takes msg.filename per message, set the action to overwrite, uncheck Add newline, and keep the encoding at none; as configured, three of those four fields ruin every JPEG.
What the exported node does today:
- Filename is
C:\Users\justst03\Documents\ScannerPhotos, a directory path used as a file name, so every image lands in one extensionless file. Blank the field and the node writes to the path each message carries. - Action is append (
"overwriteFile": "false"), which concatenates every image into one growing blob. Set overwrite so each message replaces its own file. - Add newline is on (
"appendNewline": true"), which tacks a newline byte onto a binary file. Turn it off. - Encoding is none, which passes the Buffer through untouched. Correct — leave it.
Wire a debug node set to complete msg object onto both outputs of ftp-server and force one upload; note which output carries the Buffer and which property holds the client-supplied file name. Then build a unique path per image with a function node ahead of the file node:
// illustrative: dir and stamp are local strings; msg.filename is the property the file node consumes
const dir = "C:/ScannerPhotos/";
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
msg.filename = dir + stamp + ".jpg";
return msg;
Forward slashes are valid in Windows paths and avoid the escaping mistakes backslashes invite. Keep a debug node on the ftp-server event output permanently: it is the only place login failures, aborted transfers and disconnects surface. The decision: blank filename, overwrite, no newline, encoding none, one unique path per message.
How do you prove the whole path end to end? #
After a deploy, netstat must show a LISTENING line on the chosen bind with a PID that maps to node.exe; if the local address still reads 127.0.0.1, the bind change did not take.
Run the check and confirm the owning process — the output below is an example and the PID will differ:
netstat -ano | findstr :2121
TCP 0.0.0.0:2121 0.0.0.0:0 LISTENING 7364
Get-Process -Id 7364
The answer must be node.exe. Then climb the ladder:
ipconfigconfirms the PC holds an address on the scanner's subnet with a mask that places the scanner in it; a NIC with no subnet IP fails exactly this way, as in ping fails because the laptop NIC has no subnet IP.- From the Node-RED host, a command-line FTP session to the loopback address on the configured port must return a 220 banner and accept the login, proving the server half.
- From another machine on the scanner subnet, the same session to the PC's LAN address proves the bind and the control-port rule.
- Force one scanner upload: the file appears in the target directory, its size is greater than zero, and it opens in an image viewer while the event output stays silent.
The decision: all four rungs pass and the path is proven; the first rung that fails names the fix.
Questions asked
Does the ftp-server node work when Node-RED runs in Docker?
Yes, with three changes: bind the node to 0.0.0.0 inside the container, publish the control port and the entire passive range to the host in the container settings, and mount the target directory as a host path so images survive a restart. The scanner then connects to the host's address, never the container's own.
Where are the FTP credentials kept if the flow export shows an empty credentials object?
Node-RED keeps node credentials in a separate credentials store and never writes them into a flow export, which is why the import shows an empty object. On another machine those fields are genuinely blank, so open the ftp-server node there and re-enter the user and password before the first test.
Can two ftp-server nodes run in one Node-RED instance?
Yes, as long as each node gets its own control port and the two passive ranges do not overlap. Two listeners cannot share one port, so the second bind fails outright. Overlapping ranges are worse: both servers can hand out the same data port, and a transfer stalls only when two scanners upload at the same moment.


