Skip to main content
ksivadas
Staff
Staff
Jul 15, 2025 9:16 AM UTC

Troubleshooting Tip: Resolving 'Configuration File Error' when uploading CLI scripts on FortiGate

  • Jul 16, 2026 10:28 AM UTC
  • 0 replies
  • 1105 views
  • Translate All

Description

This article addresses the 'Configuration File Error' that may occur when uploading CLI scripts to FortiGate devices. The error may appear 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


The error:

Error


To avoid running into this issue:

  1. Save script files as 'UTF-8' (without BOM) or ANSI.

  2. Avoid the '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 drop-down menu, select UTF-8 or ANSI.

  • Save the file.

 

macOS TextEdit:

  • Open the script file in TextEdit.

  • Go to Format -> Make Plain Text (if it is not already plain text).

  • Select File -> Save As.

  • In the Plain Text Encoding drop-down menu (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.


A successful operation:

Success


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.


If the issue is not fixed through the steps above, add the following configurations on the top of the script and try again to upload it:

config system ntp
    set ntpsync disable
    set server-mode disable
end


Related article:

Technical Tip: Automated script execution

    Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024