t8y2/dbx · error

Not connected. Call connect first.

Error message

Not connected. Call connect first.

What it means

requireConnectionConfig retrieves the connection configuration cached by a prior connect call (via currentConnectionConfig). The rabbitmq helper handlers require an established connection config before serving operations; without one they return this error. It is a state-machine precondition, not a network failure.

Source

Thrown at agents/drivers/rabbitmq/helpers.go:322

func connectionObject(params jsonObject) jsonObject {
	if connection := objectOrNil(params, "connection"); connection != nil {
		return connection
	}
	return params
}

func (s *server) currentConnectionConfig(params jsonObject) jsonObject {
	if connection := objectOrNil(params, "connection"); connection != nil {
		return connection
	}
	return s.cachedConnection
}

func (s *server) requireConnectionConfig(params jsonObject) (jsonObject, error) {
	connection := s.currentConnectionConfig(params)
	if connection == nil {
		return nil, errors.New("Not connected. Call connect first.")
	}
	return connection, nil
}

func (s *server) requireConnection() (*amqp.Connection, error) {
	if s.connection == nil {
		return nil, errors.New("Not connected. Call connect first.")
	}
	return s.connection, nil
}

func queueName(params jsonObject) (string, error) {
	name := stringOrEmpty(params, "topic")
	if strings.TrimSpace(name) == "" {
		name = stringOrEmpty(params, "name")
	}
	if strings.TrimSpace(name) == "" {
		return "", errors.New("topic (queue name) is required")

View on GitHub (pinned to c0390bff16)

Solutions

  1. Call connect with valid broker connection params first, verify it succeeds, then invoke the management operations.
  2. Handle the error client-side by automatically re-running connect before retrying the operation.
  3. Check why the cached config was lost (server restart, failed connect) and make the client reconnect on session loss.

Example fix

// before
topics, err := server.Call("listTopics", nil) // fails: not connected
// after
if _, err := server.Call("connect", connectParams); err != nil {
    return err
}
topics, err := server.Call("listTopics", nil)
Defensive patterns

Strategy: validation

Validate before calling

if server.CurrentConnectionConfig() == nil {
    if err := server.Connect(connectParams); err != nil {
        return err
    }
}

Try / catch

topics, err := server.Call("listTopics", nil)
if err != nil && strings.Contains(err.Error(), "Not connected") {
    if cerr := server.Connect(connectParams); cerr != nil {
        return cerr
    }
    topics, err = server.Call("listTopics", nil)
}

Prevention

When it happens

Trigger: Invoking listTopics, listConsumers, listNamespaces, createNamespace, deleteNamespace, or listExchanges before a successful connect call, or after connect failed / state was reset so currentConnectionConfig returns nil.

Common situations: Server restart discarding cached connection state while a client keeps issuing calls; connect call failing silently client-side; calling management operations from a fresh session that never ran connect.

Related errors


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