{"record":{"id":"39a47b5916cfab12","repo":"goharbor/harbor","slug":"failed-to-connect-to-tcp-s-after-d-seconds","errorCode":null,"errorMessage":"failed to connect to tcp:%s after %d seconds","messagePattern":"failed to connect to tcp:(.+?) after (.+?) seconds","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/common/utils/utils.go","lineNumber":128,"sourceCode":"\t\t\t\t\tn = n * 2\n\t\t\t\t\ttime.Sleep(time.Duration(interval) * time.Second)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif err = conn.Close(); err != nil {\n\t\t\t\t\tlog.Errorf(\"failed to close the connection: %v\", err)\n\t\t\t\t}\n\t\t\t\tsuccess <- 1\n\t\t\t\tbreak loop\n\t\t\t}\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-success:\n\t\treturn nil\n\tcase <-time.After(time.Duration(timeout) * time.Second):\n\t\tcancel <- 1\n\t\treturn fmt.Errorf(\"failed to connect to tcp:%s after %d seconds\", addr, timeout)\n\t}\n}\n\n// ParseTimeStamp parse timestamp to time\nfunc ParseTimeStamp(timestamp string) (*time.Time, error) {\n\ti, err := strconv.ParseInt(timestamp, 10, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt := time.Unix(i, 0)\n\treturn &t, nil\n}\n\n// ConvertMapToStruct is used to fill the specified struct with map.\nfunc ConvertMapToStruct(object any, values any) error {\n\tif object == nil {\n\t\treturn errors.New(\"nil struct is not supported\")\n\t}","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/common/utils/utils.go#L110-L146","documentation":"Error \"failed to connect to tcp:%s after %d seconds\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/common/utils/utils.go:128 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":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}