ARTIFACTORY: How to resolve 'Failed to parse the system yaml: yaml: invalid leading UTF-8 octetyaml validation failed' which causes Artifactory to go down

ARTIFACTORY: How to resolve 'Failed to parse the system yaml: yaml: invalid leading UTF-8 octetyaml validation failed' which causes Artifactory to go down

AuthorFullName__c
Vishal Suvarna
articleNumber
000006168
FirstPublishedDate
2024-08-19T11:21:40Z
lastModifiedDate
2024-08-19
VersionNumber
1
Symptom:
Upon upgrade/restart of the Artifactory, the instance will not start up and will throw the below error in the logs:
[WARN ] Error while initializing File resolver : yaml: invalid leading UTF-8 octet
Failed to parse the system yaml: yaml: invalid leading UTF-8 octetyaml validation failed
2024-05-24T09:58:31.178Z [shell] [WARN ] [] [installerCommon.sh:819        ] [main] - System.yaml validation failed
[WARN ] Error while initializing File resolver : yaml: invalid leading UTF-8 octet

Root Cause:
In this use case, the system.yaml file is expected to have an encoding of UTF-8 whereas it will be different in the instance having the issue.
We can check the same by executing the below command by accessing $JFROG_HOME/artifactory/var/etc directory:
file -i system.yaml

This will ideally return a value different from UTF-8.

Solution:
The current encoding of the system.yaml file needs to be changed to UTF-8 and can be done so by executing the below command by accessing $JFROG_HOME/artifactory/var/etc directory:
iconv -f <current encoding> -t UTF-8//TRANSLIT system.yaml -o system.yaml_new

Note:
‘current encoding’ is the output of the ‘file -i system.yaml’ command.
Override the system.yaml file by system.yaml_new