FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
ksivadas
Staff
Staff
Article Id 400700
Description This article addresses the 'Configuration File Error' that can occur when uploading CLI scripts to FortiGate devices. The error may present even if the same script executes successfully in the CLI.
Scope FortiGate.
Solution

When a 'Configuration File Error' appears on the FortiGate GUI during script upload, but the same script executes successfully via the CLI, the issue is often caused by incorrect file encoding or the presence of a Byte Order Mark (BOM). Below is a list of the supported and unsupported encodings of the file.

Supported and Unsupported Encodings:

Encoding Type Supported Notes
UTF-8 (no BOM) Yes Recommended
ANSI Yes Supported
UTF-8 with BOM No Not supported
UTF-16 BE BOM No Not supported
UTF-16 LE BOM No Not supported


ErrorError


To avoid running into this issue:

  1. Save script files as UTF-8 (without BOM) or ANSI.
  2. Avoid UTF-8 with BOM, UTF-16 BE BOM, and UTF-16 LE BOM formats.

 

Notepad++:

  • Open the script file.
  • Navigate to the Encoding menu.
  • Select UTF-8 (not 'UTF-8 BOM').
  • Save the file.

 

Windows Notepad:

  • Open the script file.
  •  Select File -> Save As.
  • In the Encoding dropdown, select UTF-8 or ANSI.
  • Save the file.

 

macOS TextEdit:

  • Open the script file in TextEdit.
  • Go to Format > Make Plain Text (if not already plain text).
  • Select File -> Save As.
  • In the Plain Text Encoding dropdown (at the bottom), select Unicode (UTF-8).
  •  Save the file.

 

  1. Ensure the option "If no extension is provided, use '.txt is checked as needed.
  2. Save the file.
  3. After saving the file with the correct encoding, upload the script again to the FortiGate.


SuccessSuccess

 

Note:

  1. Remove any hidden or special characters introduced during editing.
  2. If issues persist, paste the script directly into the FortiGate CLI to verify for syntax or formatting errors.
  3. Correct encoding selection ensures successful script uploads and prevents configuration file errors on FortiGate systems.

 

Related article:

Technical Tip: Automated script execution