[GH-ISSUE #1629] parse ini conf file error: invalid INI syntax on line 1: [common] #1288

Closed
opened 2026-05-05 12:49:19 -06:00 by gitea-mirror · 7 comments
Owner

Originally created by @senkawu on GitHub (Jan 21, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1629

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)
(请不要在 issue 评论中出现无意义的 加1我也是 等内容,将会被直接删除。)
(由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。)

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?
0.31.1
What operating system and processor architecture are you using (go env)?
windows server 2019
虚拟机
Configures you used:
frpc.ini

[common]
server_addr = link.****.cn
server_port = 7000
[remote]
type = tcp
local_ip = 127.0.0.1
local_port = 3389
remote_port = 5003

Steps to reproduce the issue:
1.在cmd中运行
C:\frp\frp>frpc.exe -c frpc.ini

Describe the results you received:
运行后提示这个问题
parse ini conf file error: invalid INI syntax on line 1: [common]

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):

Can you point out what caused this issue (optional)

Originally created by @senkawu on GitHub (Jan 21, 2020). Original GitHub issue: https://github.com/fatedier/frp/issues/1629 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。) (请不要在 issue 评论中出现无意义的 **加1**,**我也是** 等内容,将会被直接删除。) (由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。) Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** 0.31.1 **What operating system and processor architecture are you using (`go env`)?** windows server 2019 虚拟机 **Configures you used:** frpc.ini ``` [common] server_addr = link.****.cn server_port = 7000 [remote] type = tcp local_ip = 127.0.0.1 local_port = 3389 remote_port = 5003 ``` **Steps to reproduce the issue:** 1.在cmd中运行 `C:\frp\frp>frpc.exe -c frpc.ini` **Describe the results you received:** 运行后提示这个问题 `parse ini conf file error: invalid INI syntax on line 1: [common]` **Describe the results you expected:** **Additional information you deem important (e.g. issue happens only occasionally):** **Can you point out what caused this issue (optional)**
Author
Owner

@Sharuru commented on GitHub (Jan 29, 2020):

修改配置时,使用的工具是什么?
Windows 自带的记事本会改变文件编码。

请保存成 UTF-8 without BOM 的个格式再尝试一下。

<!-- gh-comment-id:579827731 --> @Sharuru commented on GitHub (Jan 29, 2020): 修改配置时,使用的工具是什么? Windows 自带的记事本会改变文件编码。 请保存成 UTF-8 without BOM 的个格式再尝试一下。
Author
Owner

@senkawu commented on GitHub (Jan 30, 2020):

修改配置时,使用的工具是什么?
Windows 自带的记事本会改变文件编码。

请保存成 UTF-8 without BOM 的个格式再尝试一下。

使用vscode编辑的。相同的ini配置文件在另一台电脑上就没有报错,很奇怪。

<!-- gh-comment-id:580111174 --> @senkawu commented on GitHub (Jan 30, 2020): > 修改配置时,使用的工具是什么? > Windows 自带的记事本会改变文件编码。 > > 请保存成 UTF-8 without BOM 的个格式再尝试一下。 使用vscode编辑的。相同的ini配置文件在另一台电脑上就没有报错,很奇怪。
Author
Owner

@Sharuru commented on GitHub (Jan 30, 2020):

通常来说,发生这样的错误都是因为文件格式有误导致的。

可以用 vscode 看一下文件的编码格式吗?
确认能运行的电脑使用的是相同的 ini 文件而不是内容相同吗?

如果排除掉 ini 问题的话,可能就是其他方面的编码设置导致文件读取失败了。

<!-- gh-comment-id:580112510 --> @Sharuru commented on GitHub (Jan 30, 2020): 通常来说,发生这样的错误都是因为文件格式有误导致的。 可以用 vscode 看一下文件的编码格式吗? 确认能运行的电脑使用的是相同的 ini 文件而不是内容相同吗? 如果排除掉 ini 问题的话,可能就是其他方面的编码设置导致文件读取失败了。
Author
Owner

@senkawu commented on GitHub (Jan 30, 2020):

通常来说,发生这样的错误都是因为文件格式有误导致的。

可以用 vscode 看一下文件的编码格式吗?
确认能运行的电脑使用的是相同的 ini 文件而不是内容相同吗?

如果排除掉 ini 问题的话,可能就是其他方面的编码设置导致文件读取失败了。

好的,我再尝试尝试。

<!-- gh-comment-id:580118439 --> @senkawu commented on GitHub (Jan 30, 2020): > 通常来说,发生这样的错误都是因为文件格式有误导致的。 > > 可以用 vscode 看一下文件的编码格式吗? > 确认能运行的电脑使用的是相同的 ini 文件而不是内容相同吗? > > 如果排除掉 ini 问题的话,可能就是其他方面的编码设置导致文件读取失败了。 好的,我再尝试尝试。
Author
Owner

@wy1037 commented on GitHub (Dec 2, 2020):

请问最后解决了没有,什么原因, 我也碰到了。
我的
同样的文件,win7 可以执行,
windows server 2008 r2
windows server 2012 r2
都是报错的

<!-- gh-comment-id:737128687 --> @wy1037 commented on GitHub (Dec 2, 2020): 请问最后解决了没有,什么原因, 我也碰到了。 我的 同样的文件,win7 可以执行, windows server 2008 r2 windows server 2012 r2 都是报错的
Author
Owner

@lss4 commented on GitHub (Dec 25, 2020):

It seems frp can't read the INI if it's saved in Unicode UTF-8 with BOM (Unicode UTF-8 with Signature in Notepad3). You can check and change the encoding in Notepad3.

However, the problem is that the BOM (EF BB BF) may not be visible in editors, which can lead to people looking for the cause of the issue for quite a while without realizing.

I did manage to remove this in nano from a ssh shell by backspacing and deleting whatever that were on the first line, then rewrite them, to get it working. However, it wasn't until I inspected the original file with a hex editor (like XVI32) that I realized the issue was actually caused by the UTF-8 BOM.

EDIT: Actually this was also briefly mentioned in the closing message of issue #627.

<!-- gh-comment-id:751137911 --> @lss4 commented on GitHub (Dec 25, 2020): It seems frp can't read the INI if it's saved in Unicode UTF-8 with BOM (Unicode UTF-8 with Signature in Notepad3). You can check and change the encoding in Notepad3. However, the problem is that the BOM (`EF BB BF`) may not be visible in editors, which can lead to people looking for the cause of the issue for quite a while without realizing. I did manage to remove this in `nano` from a ssh shell by backspacing and deleting whatever that were on the first line, then rewrite them, to get it working. However, it wasn't until I inspected the original file with a hex editor (like XVI32) that I realized the issue was actually caused by the UTF-8 BOM. EDIT: Actually this was also briefly mentioned in the closing message of issue #627.
Author
Owner

@hyhy01 commented on GitHub (Nov 4, 2022):

我也是换个系统就用不了了。我的解决办法是,记事本打开,去掉中文,另存为为ansi编码(原来是uft-8编码)

<!-- gh-comment-id:1302908944 --> @hyhy01 commented on GitHub (Nov 4, 2022): 我也是换个系统就用不了了。我的解决办法是,记事本打开,去掉中文,另存为为ansi编码(原来是uft-8编码)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1288
No description provided.