t8y2/dbx · error

cannot reconnect Xugu session without connection parameters

Error message

cannot reconnect Xugu session without connection parameters

What it means

This error is returned by reconnectBusinessSession when the stored connection parameters contain neither a Host nor a ConnectionString. Without either, the driver cannot re-establish the Xugu session after a disconnect.

Source

Thrown at agents/drivers/xugu/main.go:4226

	s.activeCanceled = false
	if queryErr == nil && !timedOut && !canceled {
		s.activeRows[rows] = cancel
	}
	s.activeCancelMu.Unlock()
	if queryErr != nil || timedOut || canceled {
		cancel()
		if rows != nil {
			_ = rows.Close()
		}
		queryErr = xuguOperationResultError(timedOut, canceled, timeoutSecs, queryErr)
	}
	return rows, queryErr
}

func (s *server) reconnectBusinessSession() error {
	params := s.params
	if strings.TrimSpace(params.Host) == "" && strings.TrimSpace(params.ConnectionString) == "" {
		return errors.New("cannot reconnect Xugu session without connection parameters")
	}
	currentDatabase := s.currentDatabase
	if _, err := s.connectWithControl(params, nil, false); err != nil {
		return err
	}
	return s.restoreBusinessSessionDatabase(currentDatabase)
}

func (s *server) restoreBusinessSessionDatabase(database string) error {
	if strings.TrimSpace(database) == "" {
		return nil
	}
	return s.useDatabase(database)
}

func (s *server) execWithReconnect(statement string) error {
	db, err := s.requireDB()
	if err != nil {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Ensure params.Host or params.ConnectionString is set before enabling reconnect
  2. Persist the original connection parameters on the server instance
  3. Construct the session with a full connectWithControl-compatible parameter set

Example fix

// before
params := xugu.Params{} // no Host, no ConnectionString
s.reconnectBusinessSession()
// after
params := xugu.Params{Host: "127.0.0.1", Port: 5138, User: "sysdba", Password: "..."}
s.reconnectBusinessSession()
Defensive patterns

Strategy: validation

Validate before calling

func canReconnect(p xugu.Params) bool {
    return strings.TrimSpace(p.Host) != "" || strings.TrimSpace(p.ConnectionString) != ""
}

Type guard

func hasConnectionParams(p xugu.Params) bool {
    return strings.TrimSpace(p.Host) != "" || strings.TrimSpace(p.ConnectionString) != ""
}
// guard: if !hasConnectionParams(s.params) { skip reconnect }

Try / catch

if err := s.reconnectBusinessSession(); err != nil {
    if err.Error() == "cannot reconnect Xugu session without connection parameters" {
        // surface config problem; do not retry
        return fmt.Errorf("session reconnect misconfigured: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Invoking reconnect on a server instance whose params were built with an empty Host and empty ConnectionString — typically a session constructed only for in-process or control purposes.

Common situations: Sessions created without persisted connection config that later lose connectivity; configuration lost across process restarts; params struct partially populated.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/bfc652b73ed16177. Report an issue: GitHub.