{"record":{"id":"6ed670511aa2d247","repo":"AdguardTeam/AdGuardHome","slug":"starting-web-w","errorCode":null,"errorMessage":"starting web: %w","messagePattern":"starting web: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/next/cmd/service.go","lineNumber":71,"sourceCode":"\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\n\ts.confMgrMu.RLock()\n\tdefer s.confMgrMu.RUnlock()\n\n\tvar errs []error\n\n\terr = s.confMgr.Web().Start(ctx)\n\tif err != nil {\n\t\terrs = append(errs, fmt.Errorf(\"starting web: %w\", err))\n\t}\n\n\terr = s.confMgr.DNS().Start(ctx)\n\tif err != nil {\n\t\terrs = append(errs, fmt.Errorf(\"starting dnssvc: %w\", err))\n\t}\n\n\treturn errors.Join(errs...)\n}\n\n// writePID writes the PID to the file.  Any errors are reported to log.\nfunc (s *serviceMgr) writePID(ctx context.Context) {\n\tif s.pidFilePath == \"\" {\n\t\treturn\n\t}\n\n\tpid := os.Getpid()\n\tdata := strconv.AppendInt(nil, int64(pid), 10)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/next/cmd/service.go#L53-L89","documentation":"Failed to start the web server component during service start. Collected into a joined error alongside any DNS start failure.","triggerScenarios":"confMgr.Web().Start(ctx) errors: web bind address already in use, invalid TLS certificate/key, or privileged port without permission.","commonSituations":"Port 3000/80/443 already occupied by another process, stale PID holding the socket, bad TLS files after certificate renewal.","solutions":["Free the port: 'ss -ltnp | grep :3000' and stop the conflicting process","Check bind_address/port in config","Verify TLS certificate paths and validity if HTTPS is enabled"],"exampleFix":"# before\nbind_port: 3000  # already in use\n# after\nbind_port: 3001","handlingStrategy":"validation","validationCode":"func portFree(port int) bool {\n\tln, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", port))\n\tif err != nil { return false }\n\t_ = ln.Close()\n\treturn true\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-flight check bind port availability before Start","Use distinct ports per instance; avoid privileged ports for non-root"],"tags":["web","startup","network","bind"],"backgroundTag":"address-already-in-use","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}