{"record":{"id":"337d4d26348abddd","repo":"projectdiscovery/nuclei","slug":"invalid-host-or-port-337d4d","errorCode":null,"errorMessage":"invalid host or port","messagePattern":"invalid host or port","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/js/libs/postgres/postgres.go","lineNumber":189,"sourceCode":"// ```\nfunc (c *PGClient) ConnectWithDB(ctx context.Context, host string, port int, username string, password string, dbName string) (bool, error) {\n\tok, err := c.IsPostgres(ctx, host, port)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif !ok {\n\t\treturn false, fmt.Errorf(\"not a postgres service\")\n\t}\n\n\texecutionId := ctx.Value(\"executionId\").(string)\n\n\treturn memoizedconnect(ctx, executionId, host, port, username, password, dbName)\n}\n\n// @memo\nfunc connect(ctx context.Context, executionId string, host string, port int, username string, password string, dbName string) (bool, error) {\n\tif host == \"\" || port <= 0 {\n\t\treturn false, fmt.Errorf(\"invalid host or port\")\n\t}\n\n\tif !protocolstate.IsHostAllowed(executionId, host) {\n\t\t// host is not valid according to network policy\n\t\treturn false, protocolstate.ErrHostDenied.Msgf(host)\n\t}\n\n\ttarget := net.JoinHostPort(host, fmt.Sprintf(\"%d\", port))\n\n\texecCtx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tdialer := protocolstate.GetDialersWithId(executionId)\n\tif dialer == nil {\n\t\treturn false, fmt.Errorf(\"dialers not initialized for %s\", executionId)\n\t}\n\n\tdb := pg.Connect(&pg.Options{","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/js/libs/postgres/postgres.go#L171-L207","documentation":"Error \"invalid host or port\" thrown in projectdiscovery/nuclei.","triggerScenarios":"Thrown at pkg/js/libs/postgres/postgres.go:189 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":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}