{"record":{"id":"84f34c34765e0e2f","repo":"AdguardTeam/AdGuardHome","slug":"writing-conf-w","errorCode":null,"errorMessage":"writing conf: %w","messagePattern":"writing conf: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/aghnet/net_linux.go","lineNumber":185,"sourceCode":"\tifaceName string,\n) (err error) {\n\tipNet := GetSubnet(ctx, l, ifaceName)\n\tif !ipNet.Addr().IsValid() {\n\t\treturn errors.Error(\"can't get IP address\")\n\t}\n\n\tbody, err := os.ReadFile(dhcpcdConf)\n\tif err != nil && !errors.Is(err, os.ErrNotExist) {\n\t\treturn err\n\t}\n\n\tgatewayIP := GatewayIP(ctx, l, cmdCons, ifaceName)\n\tadd := dhcpcdConfIface(ifaceName, ipNet, gatewayIP)\n\n\tbody = append(body, []byte(add)...)\n\terr = maybe.WriteFile(dhcpcdConf, body, 0o644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"writing conf: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// dhcpcdConfIface returns configuration lines for the dhcpdc.conf files that\n// configure the interface to have a static IP.\nfunc dhcpcdConfIface(ifaceName string, subnet netip.Prefix, gateway netip.Addr) (conf string) {\n\tb := &strings.Builder{}\n\tstringutil.WriteToBuilder(\n\t\tb,\n\t\t\"\\n# \",\n\t\tifaceName,\n\t\t\" added by AdGuard Home.\\ninterface \",\n\t\tifaceName,\n\t\t\"\\nstatic ip_address=\",\n\t\tsubnet.String(),\n\t\t\"\\n\",","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/aghnet/net_linux.go#L167-L203","documentation":"Identical to the JSON case, but raised while unmarshalling the weekly schedule from YAML (UnmarshalYAML). Each weekday's range is validated; the first invalid day aborts parsing with 'weekday <Day>: <cause>'.","triggerScenarios":"Loading a YAML config containing a weekly schedule where any day's start/end fails dayRange.validate (negative, start >= end, not minute-rounded, or exceeding the day).","commonSituations":"Editing the YAML config directly with invalid durations; using HH:MM:SS instead of minute precision; time-zone math producing negative durations; scheduler entries past 24:00.","solutions":["Check the named weekday and the wrapped validation cause","Set start/end as non-negative minute-aligned durations (or HH:MM strings) with start < end within the same day","Lint the YAML and use the UI's schedule editor when possible","Add unit tests for schedule parsing in your config tooling"],"exampleFix":"# before\nsat:\n  start: -01:00\n  end: 02:00:30\n# after\nsat:\n  start: 01:00\n  end: 02:00","handlingStrategy":"validation","validationCode":"# Validate before writing YAML\n# ensure start/end are non-negative, minute-aligned, start < end, end <= 24h","typeGuard":"func isValidDayRangeYAML(s, e string) bool {\n    ds, e1 := time.ParseDuration(s)\n    de, e2 := time.ParseDuration(e)\n    return e1 == nil && e2 == nil && isValidDayRange(ds, de)\n}","tryCatchPattern":"if err := yaml.Unmarshal(data, &sched); err != nil {\n    if strings.HasPrefix(err.Error(), \"weekday \") {\n        // fix the named day in the YAML source\n    }\n}","preventionTips":["Prefer minute-precision HH:MM strings in YAML","Test schedule configs with a parse step before deploy","Automate schedule generation instead of hand editing"],"tags":["schedule","yaml","validation","config","go"],"backgroundTag":"config-validation-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}