{"record":{"id":"60cd4ce07c6664c7","repo":"go-kratos/kratos","slug":"discovery-watch-self-failed","errorCode":null,"errorMessage":"Discovery watch self failed","messagePattern":"Discovery watch self failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"contrib/registry/discovery/discovery.go","lineNumber":68,"sourceCode":"\t}\n\tctx, cancel := context.WithCancel(context.Background())\n\td := &Discovery{\n\t\tconfig:     c,\n\t\tctx:        ctx,\n\t\tcancelFunc: cancel,\n\t\tapps:       map[string]*appInfo{},\n\t\tregistry:   map[string]struct{}{},\n\t}\n\n\td.httpClient = resty.New().\n\t\tSetTimeout(40 * time.Second)\n\n\t// Discovery self found and watch\n\tr := d.resolveBuild(_discoveryAppID)\n\tevent := r.Watch()\n\t_, ok := <-event\n\tif !ok {\n\t\tpanic(\"Discovery watch self failed\")\n\t}\n\tdiscoveryIns, ok := r.fetch(context.Background())\n\tif ok {\n\t\td.newSelf(discoveryIns.Instances)\n\t}\n\tgo d.selfProc(r, event)\n\n\treturn d\n}\n\n// Close stop all running process including Discovery and register\nfunc (d *Discovery) Close() error {\n\td.cancelFunc()\n\treturn nil\n}\n\n// selfProc start a goroutine to refresh Discovery self registration information.\nfunc (d *Discovery) selfProc(resolver *Resolve, event <-chan struct{}) {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/go-kratos/kratos/blob/668db92c2c001e9552594ba5a8aede8456af6d7e/contrib/registry/discovery/discovery.go#L50-L86","documentation":"Error \"Discovery watch self failed\" thrown in go-kratos/kratos.","triggerScenarios":"Thrown at contrib/registry/discovery/discovery.go:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"668db92c2c001e9552594ba5a8aede8456af6d7e","analyzedAt":"2026-08-16T02:07:20.704Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}