{"record":{"id":"102a3e5b6cfc97aa","repo":"jeessy2/ddns-go","slug":"api-token-cannot-be-empty","errorCode":null,"errorMessage":"API token cannot be empty","messagePattern":"API token cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dns/hipmdnsmgr.go","lineNumber":140,"sourceCode":"\t\tif err != nil {\n\t\t\tutil.Log(\"新增域名解析 %s 失败! 异常信息: %s\", domain, err)\n\t\t\tdomain.UpdateStatus = config.UpdatedFailed\n\t\t} else {\n\t\t\tutil.Log(\"新增域名解析 %s 成功! IP: %s\", domain, ipAddr)\n\t\t\tdomain.UpdateStatus = config.UpdatedSuccess\n\t\t}\n\t}\n}\n\n// updateRecord 更新或创建 DNS 记录\nfunc (h *HiPMDnsMgr) updateRecord(domain *config.Domain, ipAddr string, recordType string) error {\n\tbaseURL := h.DNS.ID\n\tif baseURL == \"\" {\n\t\tbaseURL = hipmDnsMgrEndpoint\n\t}\n\tapiToken := h.DNS.Secret\n\tif apiToken == \"\" {\n\t\treturn fmt.Errorf(\"API token cannot be empty\")\n\t}\n\n\t// Get domain ID\n\tdomainID, err := h.getDomainID(baseURL, apiToken, domain.DomainName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get domain ID: %w\", err)\n\t}\n\n\t// Get existing record\n\trecord, err := h.getRecord(baseURL, apiToken, domainID, domain.SubDomain, recordType)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get record: %w\", err)\n\t}\n\n\tttl, _ := strconv.Atoi(h.TTL)\n\tif ttl == 0 {\n\t\tttl = 600\n\t}","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/jeessy2/ddns-go/blob/5874c2e6667c69357ab95079421131104bd3fcae/dns/hipmdnsmgr.go#L122-L158","documentation":"Thrown by HiPMDnsMgr.updateRecord when h.DNS.Secret is empty, i.e. the HiPM DNS Manager provider was configured without an API token. The library refuses to call getDomainID/update/create because every request requires token authentication. It is a configuration validation error raised before any network I/O.","triggerScenarios":"addUpdateDomainRecords dispatches to updateRecord for a domain while the HiPMDnsMgr DNS config block has an empty Secret field.","commonSituations":"Missing secret/token in the ddns-go config file or web UI for the HiPM DNS Manager provider; user filled in ID (custom endpoint) but left Secret blank; config migration or hand-edited JSON dropped the secret field.","solutions":["Open the ddns-go config and set Secret to your HiPM DNS Manager API token","If editing the config JSON directly, ensure the dns section for this provider has \"Secret\": \"<token>\"","Regenerate the API token from the HiPM DNS Manager console if you don't have one","Restart/reload ddns-go after saving the config"],"exampleFix":"// before (config)\n{\n  \"DNS\": { \"Name\": \"hipmdnsmgr\", \"ID\": \"\", \"Secret\": \"\" }\n}\n// after (config)\n{\n  \"DNS\": { \"Name\": \"hipmdnsmgr\", \"ID\": \"\", \"Secret\": \"your-api-token\" }\n}","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(h.DNS.Secret) == \"\" {\n    return fmt.Errorf(\"HiPM DNS Manager API token must be configured in Secret field\")\n}","typeGuard":"func isMissingTokenErr(err error) bool {\n    return strings.Contains(err.Error(), \"API token cannot be empty\")\n}","tryCatchPattern":"err := h.updateRecord(domain, ipAddr, recordType)\nif err != nil {\n    if isMissingTokenErr(err) {\n        // prompt user to configure Secret before retrying\n    }\n    return err\n}","preventionTips":["Set the Secret field in ddns-go config for the HiPM DNS Manager provider before enabling it","Validate provider credentials at startup, not on first update","Avoid hand-editing config JSON in ways that drop the Secret key"],"tags":["config","authentication","missing-credentials","go"],"backgroundTag":"missing-api-token","analyzedSha":"5874c2e6667c69357ab95079421131104bd3fcae","analyzedAt":"2026-09-03T15:41:16.799Z","contentChangedAt":"2026-09-03T15:41:16.799Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}