{"record":{"id":"2ac83c8c51f1b36e","repo":"AdguardTeam/AdGuardHome","slug":"generating-config-file-w","errorCode":null,"errorMessage":"generating config file: %w","messagePattern":"generating config file: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/home/config.go","lineNumber":917,"sourceCode":"\t\tdns.UpstreamTimeout = timeutil.Duration(s.UpstreamTimeout())\n\t}\n\n\tif globalContext.dhcpServer != nil {\n\t\tglobalContext.dhcpServer.WriteDiskConfig(config.DHCP)\n\t}\n\n\tconfig.Clients.Persistent = globalContext.clients.forConfig()\n\n\tconfPath = configFilePath(ctx, l, workDir, confPath)\n\tl.DebugContext(ctx, \"writing config file\", \"path\", confPath)\n\n\tbuf := &bytes.Buffer{}\n\tenc := yaml.NewEncoder(buf)\n\tenc.SetIndent(2)\n\n\terr = enc.Encode(config)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"generating config file: %w\", err)\n\t}\n\n\terr = maybe.WriteFile(confPath, buf.Bytes(), aghos.DefaultPermFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"writing config file: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// validateTLSCipherIDs validates the custom TLS cipher suite IDs.\nfunc validateTLSCipherIDs(cipherIDs []string) (err error) {\n\tif len(cipherIDs) == 0 {\n\t\treturn nil\n\t}\n\n\t_, err = aghtls.ParseCiphers(cipherIDs)\n\tif err != nil {","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/home/config.go#L899-L935","documentation":"Writing the config file object failed at the YAML encoding stage: yaml.Encoder could not serialize the configuration into bytes. Encoding errors usually reflect unmarshalable or incompatible field types after schema changes.","triggerScenarios":"Persisting config (e.g. after a setup/PUT /control/config or internal update) where some field of the config struct cannot be marshaled to YAML.","commonSituations":"Version mismatches or corrupted in-memory config after partial upgrades; exotic custom types injected by plugins; extremely rare in stock builds.","solutions":["Check the wrapped error for the offending field","Recreate the config from a known-good backup instead of the corrupted state","Upgrade to a consistent AdGuard Home version (avoid mixing binaries and data from different releases)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Fall back to last known-good config file\nif err := persistConfig(cfg); err != nil { cfg = loadBackup() }","preventionTips":["Don't mix binaries and data dirs across versions","Keep config backups so a corrupt state can be replaced"],"tags":["config","yaml","serialization"],"backgroundTag":"yaml-serialization-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}