XIU2/CloudflareSpeedTest · warning
Failed to get the preferred IPv6 address.
Error message
Failed to get the preferred IPv6 address.
What it means
The IPv6 mirror of the IPv4 branch: cfst_dnspod.sh runs ./cfst -f ipv6.txt -n 500 -o result6.csv (line 79), reads preferred_ipv6=$(awk -F, 'NR==2 {print $1}' result6.csv) (line 82), and at line 86 prints this message when it is empty, skipping AAAA record lookup/create/update. The script then ends normally.
Source
Thrown at script/cfst_dnspod.sh:86
# 创建 IPv4 记录
new_ipv4_record_id=$(create_dns_record "A" "$preferred_ipv4")
if [ -n "$new_ipv4_record_id" ]; then
echo "Created DNSPod record with IPv4: $preferred_ipv4"
else
echo "Failed to create DNSPod record with IPv4."
fi
fi
fi
# 运行 CFST v6
./cfst -f ipv6.txt -n 500 -o result6.csv
# 读取 CSV 文件并提取优选 IPv6 地址
preferred_ipv6=$(awk -F, 'NR==2 {print $1}' result6.csv)
# 检查是否获取到了 IPv6 地址
if [ -z "$preferred_ipv6" ]; then
echo "Failed to get the preferred IPv6 address."
else
echo "BETTER IPv6: $preferred_ipv6"
# 获取 IPv6 记录 ID
ipv6_record_id=$(get_record_id "AAAA")
if [ -n "$ipv6_record_id" ]; then
# 更新 IPv6 记录
update_dns_record "$ipv6_record_id" "AAAA" "$preferred_ipv6"
echo "Updated DNSPod record with IPv6: $preferred_ipv6"
else
# 创建 IPv6 记录
new_ipv6_record_id=$(create_dns_record "AAAA" "$preferred_ipv6")
if [ -n "$new_ipv6_record_id" ]; then
echo "Created DNSPod record with IPv6: $preferred_ipv6"
else
echo "Failed to create DNSPod record with IPv6."
fiView on GitHub (pinned to 1da0c025d7)
Solutions
- Confirm ipv6.txt exists next to the script and cfst, then run ./cfst -f ipv6.txt -n 500 -o result6.csv manually to see the real output
- If the host has no IPv6 route, treat this as informational or delete the IPv6 block (lines 78-106) — the IPv4 update already completed
- Verify IPv6 connectivity: ping -6 2606:4700:4700::1111; relax -n/-t filters if tests fail marginally
- Guard the parse: [ -s result6.csv ] && [ $(wc -l < result6.csv) -ge 2 ] || preferred_ipv6=''
Example fix
# script/cfst_dnspod.sh (before)
preferred_ipv6=$(awk -F, 'NR==2 {print $1}' result6.csv)
# (after)
if [ -f ipv6.txt ] && [ -s result6.csv ] && [ "$(wc -l < result6.csv)" -ge 2 ]; then
preferred_ipv6=$(awk -F, 'NR==2 {print $1}' result6.csv)
else
preferred_ipv6=''
fi Defensive patterns
Strategy: validation
Validate before calling
[ -x ./cfst ] && [ -f ipv6.txt ] || { echo 'cfst/ipv6.txt missing' >&2; exit 1; }
ping -c1 -6 2606:4700:4700::1111 >/dev/null 2>&1 || echo 'no IPv6 connectivity — AAAA update will be skipped' >&2 Type guard
is_ipv6(){ [[ $1 =~ ^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$ ]]; }
is_ipv6 "$preferred_ipv6" || echo 'preferred_ipv6 not valid' >&2 Prevention
- Copy ipv6.txt alongside ip.txt when deploying; the script hardcodes -f ipv6.txt
- Check host IPv6 routing before expecting AAAA updates on an IPv4-only box
- If IPv6 is unwanted, remove the v6 block (lines 78-106) to silence the recurring message
When it happens
Trigger: result6.csv missing because ./cfst -f ipv6.txt never ran (ipv6.txt not in the working directory — the repo ships it at the root, but deployments often copy only ip.txt) or cfst exited early; the host has no IPv6 connectivity so no IPv6 target passes; -n 500 larger than ipv6.txt's entry count; header-only CSV.
Common situations: Running on an IPv4-only VPS/home network where every IPv6 test fails; executing from a directory lacking ipv6.txt; the user never intended IPv6 but the script unconditionally attempts it, so the message is expected noise.
Related errors
- Failed to get the preferred IPv4 address.
- Failed to create DNSPod record with IPv6.
- [错误] 缺少配置项 [TYPE] !
- [错误] 缺少配置项 [NAME] !
- [错误] 缺少配置项 [TTL] !
AI-assisted analysis of XIU2/CloudflareSpeedTest@1da0c025d7 (2026-08-15).
Data as JSON: /api/errors/8714bd293e7de859.
Report an issue: GitHub.