{"record":{"id":"8713dbe2c8100926","repo":"AdguardTeam/AdGuardHome","slug":"creating-config-manager-w","errorCode":null,"errorMessage":"creating config manager: %w","messagePattern":"creating config manager: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/next/cmd/service.go","lineNumber":45,"sourceCode":"}\n\n// serviceMgrConfig contains service manager configuration parameters.\ntype serviceMgrConfig struct {\n\t// confMgrConf is the configuration manager config, it must not be nil.\n\tconfMgrConf *configmgr.Config\n\n\t// logger is the logger used to log services activity, it must not be nil.\n\tlogger *slog.Logger\n\n\t// pidFilePath is the path to the file where to store the PID, if any.\n\tpidFilePath string\n}\n\n// newServiceMgr creates a new *serviceMgr.\nfunc newServiceMgr(ctx context.Context, conf *serviceMgrConfig) (s *serviceMgr, err error) {\n\tconfMgr, err := configmgr.New(ctx, conf.confMgrConf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating config manager: %w\", err)\n\t}\n\n\treturn &serviceMgr{\n\t\tconfMgr:     confMgr,\n\t\tconfMgrMu:   &sync.RWMutex{},\n\t\tconfMgrConf: conf.confMgrConf,\n\t\tlogger:      conf.logger,\n\t\tpidFilePath: conf.pidFilePath,\n\t}, nil\n}\n\n// type check\nvar _ service.Interface = (*serviceMgr)(nil)\n\n// Start implements the [service.Interface] interface for *serviceMgr.\nfunc (s *serviceMgr) Start(ctx context.Context) (err error) {\n\ts.writePID(ctx)\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/next/cmd/service.go#L27-L63","documentation":"Creating the config manager (configmgr.New) failed during service startup; the inner error comes from the config manager subsystem (loading/parsing configuration, setting up DNS/web handlers).","triggerScenarios":"newServiceMgr calls configmgr.New with conf.confMgrConf; failure of any subordinate initialization (bad YAML, unreadable working dir, invalid settings) surfaces here.","commonSituations":"Malformed AdGuard Home YAML, schema/validation errors after an upgrade, unreadable files due to permissions.","solutions":["Check the inner error and the config file at the reported path","Validate YAML syntax (yamllint / yaml round-trip)","Restore a known-good backup of the config"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(conf.ConfigPath); err != nil {\n\tlog.Fatalf(\"config file problem: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"s, err := newServiceMgr(ctx, conf)\nif err != nil {\n\tlog.Printf(\"startup failed: %v\", errors.Unwrap(err))\n\tos.Exit(1)\n}","preventionTips":["Validate YAML in CI before deploy","Back up config before upgrades"],"tags":["startup","config","initialization"],"backgroundTag":"startup-config-load-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}