IMD SolutionComputing LibraryShop main store

Troubleshooting

Edge gateway config mode error: edit the right Gateway.cfg

Edge computing and IIoT Published 5 min read By IMD Solution engineering team

Short answer

When the Allow Edge Gateway... tray command throws an error, the gateway service is reading a different Gateway.cfg than the one being edited: it runs as the system account and reads the file in the newest randomly named folder under CODESYSGatewayV3. Add MaintenanceMode=1 under the CmpEdgeGateway section there and retry the tray command; if it still fails, version 3.5.20.0 is the reported fallback that works without any edit.

On this page
  1. What the config mode error is
  2. The Gateway.cfg the service actually reads
  3. Editing Gateway.cfg in the newest folder
  4. Worked example: patch 3 on Windows 10 x64 leaves two folders
  5. When to install version 3.5.20.0 instead
  6. Questions asked

If the Allow Edge Gateway... command in the gateway's tray menu throws an error or warning window, or quietly does nothing, the gateway itself is usually healthy: the change went into the wrong Gateway.cfg. The CODESYS Edge Gateway service on Windows runs under the system account, so it reads its configuration from a file under the system profile, and every installation writes that file into a new, randomly named folder. Add MaintenanceMode=1 under the CmpEdgeGateway section in the newest folder's Gateway.cfg and the tray command works again. If the edit in the verified-newest folder still fails, version 3.5.20.0 is the reported fallback: on that build the tray command activates config mode with no file edit at all.

What the config mode error is #

On Windows 10 x64, right-clicking the gateway icon in the task tray and choosing Allow Edge Gateway... is meant to switch the gateway into config mode on the spot. Instead, the command pops an error or warning window, or completes with no effect, and it keeps doing so even after the latest patch is applied. The gateway's documented role is to connect the CODESYS Automation Server with the CODESYS controllers in the local plant network, and this tray command is the intended local switch for its config mode.

The command misbehaves for a reason that has nothing to do with a broken service. The fix that settles the case is a two-line change in a file most people never open, because the running service does not read the copies people edit first: it reads the Gateway.cfg under the system profile, in the folder created by the most recent installation. An edit in a user-profile copy, or in a folder left over from an earlier install, changes a file nothing reads, which is exactly what the persistent error looks like from outside.

One naming warning before you search further: this config mode belongs to the gateway service. It has nothing to do with the config mode an IPC can stay in after a power cycle when a TwinCAT runtime refuses to leave configuration state; that separate fault is covered step by step in fixing a TwinCAT IPC that stays in Config mode after a power cycle.

The Gateway.cfg the service actually reads #

The service runs as the local system account, so its roaming configuration lives under the system profile, not under your user profile. The folder that matters is C:\Windows\System32\config\systemprofile\AppData\Roaming\CODESYS\CODESYSGatewayV3. Inside it, the installer creates one randomly named subfolder per installation, and each subfolder carries that installation's own Gateway.cfg.

Two consequences follow. An edit under your own AppData, or anywhere else outside this tree, cannot help, because the service never reads it. And after a patch install you may find two subfolders side by side: the newer one belongs to the running service, and the older one is a dead copy from the superseded installation. The folder name itself is random, so the creation timestamp, not the name, tells you which file to open.

Editing Gateway.cfg in the newest folder #

  1. Paste C:\Windows\System32\config\systemprofile\AppData\Roaming\CODESYS\CODESYSGatewayV3 into the File Explorer address bar; the tree is hidden from normal browsing, and the full path opens it without touching hidden-file settings.
  2. Sort the subfolders by Date created and open the newest one, meaning the folder created at your last installation or patch.
  3. Open Gateway.cfg from that folder in a plain-text editor and add the two lines shown after this list, creating the CmpEdgeGateway section if the file does not already carry one.
  4. Save the file as plain text and confirm the editor kept the name Gateway.cfg rather than adding a .txt extension.
  5. Retry Allow Edge Gateway... in the tray. If the error or warning window still appears, restart the gateway service or reboot the host so the service reads the changed file, then try once more.
[CmpEdgeGateway]
MaintenanceMode=1

Schedule the service restart or reboot for a change window: while the gateway service is down, the Automation Server cannot reach the controllers behind it.

Worked example: patch 3 on Windows 10 x64 leaves two folders #

This is the case as the report gives it, with the folder list taken from the machine in question.

Inputs:

  • Host: Windows 10 x64, with the Edge Gateway installed and a patch applied on top; the reporter had installed patch 3.
  • Folder A: a subfolder under CODESYSGatewayV3 created at the original installation, holding its Gateway.cfg.
  • Folder B: a second subfolder created today, at the moment the patch finished; the report notes the newest folder was created at the time of installation.
  • The service reads only inside the system-profile tree above, so no other copy on the machine matters.

The rule in words: each installation generates a fresh, randomly named folder, and the running service reads the Gateway.cfg of the most recent installation, so the edit belongs in the folder with the newest creation timestamp.

The comparison, written out:

created(Folder A, original installation)  is earlier than  created(Folder B, patch, today)
newest folder = Folder B
the running service reads the Gateway.cfg in Folder B

Result: MaintenanceMode=1 sits under the CmpEdgeGateway section in Folder B's Gateway.cfg, saved as plain text with the name intact. An edit into Folder A lands in a file nothing reads, which is why the same error returns no matter how often the change is repeated.

Decision: retry the tray command. If Allow Edge Gateway... now activates config mode without an error or warning window, the case is closed. If the identical error returns and the timestamps confirm Folder B really is the newest, stop editing files; the remaining fix in this case is the version rollback below.

When to install version 3.5.20.0 instead #

Engineers who hit this exact case uninstalled the current Edge Gateway build and installed version 3.5.20.0 from the CODESYS Store; after that, they report, right-clicking the tray icon and choosing Allow Edge Gateway... activates config mode with no error or warning window and no manual edit. The vendor's store currently lists 3.5.22.40 for the Windows Edge Gateway, so the rollback is a downgrade that gives up whatever the newer patches changed; treat it as the fallback, not the default, and plan the return to a current build for when a release restores the tray behavior.

The decision, stated plainly: try the file edit first, because it changes one file, keeps the newer build and takes minutes. Install 3.5.20.0 when the edit in the verified-newest folder does not clear the error, or when the people who need to switch config mode on cannot be given file access and must have a working tray command. Both routes end in the same state: config mode activated, no error window.

Questions asked

Does this fix apply to the Edge Gateway for Linux?

No. The Edge Gateway for Linux is a separate package, currently listed at version 4.23.0.0, with its own file layout. The system-profile path, the randomly named subfolder and the MaintenanceMode line are specific to the Windows install, so do not carry them onto a Linux host.

I edited the copies under both System32 and SysWOW64 and the error stays. Why?

On 64-bit Windows a mirrored set of gateway folders can sit under the SysWOW64 system-profile tree, and both trees follow the same rule: each installation creates its own randomly named folder and the service reads only the newest. If the error persists after editing both, at least one edit landed in a stale folder, so sort each tree by creation date and edit the folder created at your last installation or patch.

Why does the folder under CODESYSGatewayV3 have a random name?

The installer generates a fresh, installation-specific name every time the gateway or a patch is installed, so the name carries no meaning and cannot be predicted or reused. That is why the creation timestamp, not the folder name, is the only reliable way to identify the folder the running service reads.

Is there a way to turn config mode on without editing any file?

Only by rolling back. In this case, engineers who uninstalled the current build and installed version 3.5.20.0 found the tray command worked with no error window and no edit; the case notes show no file-free method on builds newer than that. If you stay current, the MaintenanceMode edit is the working route.

Keep reading

  • Troubleshooting

    Edge gateway online but PLC offline: diagnose the link

    Gateway online only proves the Automation Server can reach the gateway; it says nothing about the gateway-to-PLC session. Confirm the scan result, switch on file logging in /etc/Gateway.cfg under [CmpLog], reproduce the failure, and read /tmp/codesysedge.log at the failure timestamp. A reinstall that holds for about a month points at a returning state: certificate validity, clock drift, address change, or an overwritten configuration.

    Edge computing and IIoT

  • Explainer

    ABB TotalFlow module for Ignition: what exists today

    The ABB TotalFlow entry on the Ignition Edge IIoT page is an entitlement, not a download: the driver is a third-party Cirrus Link module that reached beta after that listing was written. It runs on Ignition Edge and standard Ignition, polls G2 late, G3, G4 and G5 flow computers, and needs MQTT Transmission to publish, because the G5 has no native MQTT client.

    Edge computing and IIoT

  • How-to

    Bridging OPC UA PLC data to MQTT with an edge PC

    Keep the OPC UA server on the PLC side and give MQTT publishing its own role on a separate edge PC that acts as the OPC UA client and MQTT publisher. Commission the two links independently — first a verified tag read, then a verified subscriber message — and only then widen the tag set.

    Edge computing and IIoT