projectdiscovery/nuclei · error

invalid host or port

Error message

invalid host or port

What it means

Error "invalid host or port" thrown in projectdiscovery/nuclei.

Source

Thrown at pkg/js/libs/postgres/postgres.go:189

// ```
func (c *PGClient) ConnectWithDB(ctx context.Context, host string, port int, username string, password string, dbName string) (bool, error) {
	ok, err := c.IsPostgres(ctx, host, port)
	if err != nil {
		return false, err
	}
	if !ok {
		return false, fmt.Errorf("not a postgres service")
	}

	executionId := ctx.Value("executionId").(string)

	return memoizedconnect(ctx, executionId, host, port, username, password, dbName)
}

// @memo
func connect(ctx context.Context, executionId string, host string, port int, username string, password string, dbName string) (bool, error) {
	if host == "" || port <= 0 {
		return false, fmt.Errorf("invalid host or port")
	}

	if !protocolstate.IsHostAllowed(executionId, host) {
		// host is not valid according to network policy
		return false, protocolstate.ErrHostDenied.Msgf(host)
	}

	target := net.JoinHostPort(host, fmt.Sprintf("%d", port))

	execCtx, cancel := context.WithCancel(ctx)
	defer cancel()

	dialer := protocolstate.GetDialersWithId(executionId)
	if dialer == nil {
		return false, fmt.Errorf("dialers not initialized for %s", executionId)
	}

	db := pg.Connect(&pg.Options{

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at pkg/js/libs/postgres/postgres.go:189 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/337d4d26348abddd. Report an issue: GitHub.