{"record":{"id":"8540fa49c7d5ca8d","repo":"AdguardTeam/AdGuardHome","slug":"duplicated-values-v","errorCode":null,"errorMessage":"duplicated values: %v","messagePattern":"duplicated values: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/aghalg/aghalg.go","lineNumber":66,"sourceCode":"\treturn merged\n}\n\n// Validate returns an error enumerating all elements that aren't unique.\nfunc (uc UniqChecker[T]) Validate() (err error) {\n\tvar dup []T\n\tfor elem, num := range uc {\n\t\tif num > 1 {\n\t\t\tdup = append(dup, elem)\n\t\t}\n\t}\n\n\tif len(dup) == 0 {\n\t\treturn nil\n\t}\n\n\tslices.Sort(dup)\n\n\treturn fmt.Errorf(\"duplicated values: %v\", dup)\n}\n","sourceCodeStart":48,"sourceCodeEnd":68,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/aghalg/aghalg.go#L48-L68","documentation":"This error is returned by the service manager's Refresh operation when it fails to rebuild its configuration manager before restarting services. Refresh creates a brand-new configmgr.New instance from s.confMgrConf, and any failure in that construction (config file unreadable, invalid YAML, bad settings) surfaces wrapped here. It aborts the reconfiguration before any services are restarted.","triggerScenarios":"Calling serviceMgr.Refresh (e.g. on SIGHUP or after config edits) while the underlying configuration file is malformed, missing, unreadable (permissions), or contains values the config manager rejects during New().","commonSituations":"Editing the YAML config by hand and introducing a syntax error, then triggering a refresh; changing file ownership/permissions so the process cannot read the config; upgrading to a version with stricter config validation while keeping an old config file.","solutions":["Inspect the wrapped error with errors.Unwrap to find the real cause (usually a config parse or validation message)","Validate the configuration file with a YAML linter or by running the config manager's validate path before refreshing","Fix file permissions (chown/chmod) so the service account can read the config","Restore the last known-good config backup and refresh again"],"exampleFix":"# before\nerr := srv.Refresh(ctx)\n# after\nerr := srv.Refresh(ctx)\nif err != nil {\n    log.Printf(\"refresh failed: %v\", errors.Unwrap(err)) // real cause\n}","handlingStrategy":"try-catch","validationCode":"// Validate config parses before refreshing\ncfg, err := config.Load(path)\nif err != nil { log.Fatal(err) }","typeGuard":null,"tryCatchPattern":"if err := svc.Refresh(ctx); err != nil {\n    if strings.Contains(err.Error(), \"updating configuration manager\") {\n        // config problem; inspect errors.Unwrap(err)\n    }\n    return fmt.Errorf(\"refresh: %w\", err)\n}","preventionTips":["Lint/validate config files before triggering refresh","Keep config backups and diff before applying","Run config validation as a pre-deploy step in CI"],"tags":["config","refresh","service-manager","go"],"backgroundTag":"config-load-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}