XIU2/CloudflareSpeedTest · error

[错误] 缺少配置项 [FOLDER] !

Error message

[错误] 缺少配置项 [FOLDER] !

What it means

cfst_ddns.sh's _READ() parses cfst_ddns.conf by piping the whole file through grep 'FOLDER=' | awk -F '=' '{print $NF}' and taking the text after the last '='. If that yields an empty string, the script prints the error and exits 1 at script/cfst_ddns.sh:15, aborting before any speed test or DNS update. FOLDER is load-bearing: the main block runs cd "${FOLDER}" (line 64) before ./cfst, so it must be the directory holding the cfst binary and ip.txt.

Source

Thrown at script/cfst_ddns.sh:15

#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# --------------------------------------------------------------
#	项目: CloudflareSpeedTest 自动更新域名解析记录
#	版本: 1.0.5
#	作者: XIU2
#	项目: https://github.com/XIU2/CloudflareSpeedTest
# --------------------------------------------------------------

_READ() {
	[[ ! -e "cfst_ddns.conf" ]] && echo -e "[错误] 配置文件不存在 [cfst_ddns.conf] !" && exit 1
	CONFIG=$(cat "cfst_ddns.conf")
	FOLDER=$(echo "${CONFIG}"|grep 'FOLDER='|awk -F '=' '{print $NF}')
	[[ -z "${FOLDER}" ]] && echo -e "[错误] 缺少配置项 [FOLDER] !" && exit 1
	ZONE_ID=$(echo "${CONFIG}"|grep 'ZONE_ID='|awk -F '=' '{print $NF}')
	[[ -z "${ZONE_ID}" ]] && echo -e "[错误] 缺少配置项 [ZONE_ID] !" && exit 1
	DNS_RECORDS_ID=$(echo "${CONFIG}"|grep 'DNS_RECORDS_ID='|awk -F '=' '{print $NF}')
	[[ -z "${DNS_RECORDS_ID}" ]] && echo -e "[错误] 缺少配置项 [DNS_RECORDS_ID] !" && exit 1
	KEY=$(echo "${CONFIG}"|grep 'KEY='|awk -F '=' '{print $NF}')
	[[ -z "${KEY}" ]] && echo -e "[错误] 缺少配置项 [KEY] !" && exit 1
	EMAIL=$(echo "${CONFIG}"|grep 'EMAIL='|awk -F '=' '{print $NF}')
	[[ -z "${EMAIL}" ]] && echo -e "[信息] 缺少配置项 [EMAIL],由 [API 密钥] 方式转为 [API 令牌] 方式!"
	TYPE=$(echo "${CONFIG}"|grep 'TYPE='|awk -F '=' '{print $NF}')
	[[ -z "${TYPE}" ]] && echo -e "[错误] 缺少配置项 [TYPE] !" && exit 1
	NAME=$(echo "${CONFIG}"|grep 'NAME='|awk -F '=' '{print $NF}')
	[[ -z "${NAME}" ]] && echo -e "[错误] 缺少配置项 [NAME] !" && exit 1
	TTL=$(echo "${CONFIG}"|grep 'TTL='|awk -F '=' '{print $NF}')
	[[ -z "${TTL}" ]] && echo -e "[错误] 缺少配置项 [TTL] !" && exit 1
	PROXIED=$(echo "${CONFIG}"|grep 'PROXIED='|awk -F '=' '{print $NF}')
	[[ -z "${PROXIED}" ]] && echo -e "[错误] 缺少配置项 [PROXIED] !" && exit 1
}

View on GitHub (pinned to 1da0c025d7)

Solutions

  1. Open cfst_ddns.conf in the directory you run the script from and set FOLDER to the folder containing the cfst binary and ip.txt, e.g. FOLDER=/opt/cfst
  2. Make sure the line starts at column 1 (no leading '#') and the value follows '=' immediately with no spaces
  3. Confirm the path is valid relative to the script's working directory, because line 64 does cd "${FOLDER}"
  4. Re-run bash cfst_ddns.sh — _READ must clear all checks before _UPDATE starts

Example fix

# cfst_ddns.conf (before)
FOLDER=
# (after)
FOLDER=/opt/cfst
Defensive patterns

Strategy: validation

Validate before calling

grep -q '^FOLDER=.' cfst_ddns.conf || { echo 'missing/empty FOLDER in cfst_ddns.conf' >&2; exit 1; }

Prevention

When it happens

Trigger: cfst_ddns.conf exists next to the script (otherwise the earlier file-not-found error fires) but the FOLDER= line is absent, commented out, or present with nothing after the '=' sign.

Common situations: Fresh setup where the sample conf was copied but FOLDER left blank; the line has a stray '#' prefix; the conf was replaced by an older template missing the key. grep matches the key anywhere in a line, so a valueless '# FOLDER=' comment still leaves FOLDER empty.

Related errors


AI-assisted analysis of XIU2/CloudflareSpeedTest@1da0c025d7 (2026-08-15). Data as JSON: /api/errors/2552d8deb0238286. Report an issue: GitHub.