t8y2/dbx · warning

close Hive Agent sessions: %s

Error message

close Hive Agent sessions: %s

What it means

Aggregate error from `closeAllSessions`: after swapping out and clearing the sessions map, the driver disconnects every remaining agentSession under its own mutex; any per-session `disconnect()` error is collected as "id: err" strings and, if any occurred, wrapped into a single "close Hive Agent sessions: ..." error joined with "; ". The sessions are all removed from the registry regardless, so this error reports partial cleanup failures (typically network/transport errors while tearing down the underlying Hive connection), not a failure to close.

Source

Thrown at agents/drivers/argo-go/main.go:310

	return session.server.disconnect()
}

func (runtimeServer *runtimeServer) closeAllSessions() error {
	runtimeServer.mu.Lock()
	sessions := runtimeServer.sessions
	runtimeServer.sessions = map[string]*agentSession{}
	runtimeServer.mu.Unlock()
	var failures []string
	for id, session := range sessions {
		session.mu.Lock()
		err := session.server.disconnect()
		session.mu.Unlock()
		if err != nil {
			failures = append(failures, fmt.Sprintf("%s: %v", id, err))
		}
	}
	if len(failures) > 0 {
		return fmt.Errorf("close Hive Agent sessions: %s", strings.Join(failures, "; "))
	}
	return nil
}

func newServer(params connectParams) (*server, error) {
	config, err := parseConnectionConfig(params)
	if err != nil {
		return nil, err
	}
	server := &server{
		params:        params,
		config:        config,
		querySessions: map[string]*querySession{},
	}
	if err := server.openConnection(); err != nil {
		return nil, err
	}
	return server, nil

View on GitHub (pinned to c0390bff16)

Solutions

  1. Parse the joined message: each ';'-separated "id: err" pair names a session whose underlying connection already failed — these are usually benign at shutdown; log and treat as non-fatal if the process is exiting anyway.
  2. Verify Hive server reachability; if disconnect reports network errors, fix connectivity or increase the disconnect/transport timeout before shutdown.
  3. Avoid closing sessions with in-flight requests; wait for active requests to complete (or cancel them) before shutdown so disconnects are clean.
  4. If errors repeat, check driver/server version mismatch on the Hive transport and reconnect sessions individually to confirm which teardown path fails.
Defensive patterns

Strategy: try-catch

Try / catch

if err := rt.closeAllSessions(); err != nil {
    for _, failure := range strings.Split(strings.TrimPrefix(err.Error(), "close Hive Agent sessions: "), "; ") {
        log.Printf("session teardown failure (non-fatal at shutdown): %s", failure)
    }
}

Prevention

When it happens

Trigger: Calling closeAllSessions (via dispatch's shutdown path) when one or more underlying `session.server.disconnect()` calls return errors — e.g. the Hive server already dropped the TCP connection, a disconnect timeout fired, or the driver/transport was already torn down for that session.

Common situations: Shutting the agent down while the Hive backend is unreachable or has idle-timed-out connections; closing after an abrupt network drop so disconnect gets 'connection reset'/'broken pipe'; sessions in the middle of an active request whose transport errors on teardown; multiple bad sessions accumulate into one joined message.

Related errors


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