t8y2/dbx · error

%s is required

Error message

%s is required

What it means

requireBindingName validates that a mandatory binding parameter (source, destination, etc.) is present and non-blank. The error message interpolates the missing key name ('%s is required'), so it names exactly which field was empty.

Source

Thrown at agents/drivers/rabbitmq/operations.go:600

	if err != nil {
		return err
	}
	if destinationType == "queue" {
		if bind {
			return channel.QueueBind(destination, routingKey, source, false, arguments)
		}
		return channel.QueueUnbind(destination, routingKey, source, arguments)
	}
	if bind {
		return channel.ExchangeBind(destination, routingKey, source, false, arguments)
	}
	return channel.ExchangeUnbind(destination, routingKey, source, false, arguments)
}

func requireBindingName(params jsonObject, key string) (string, error) {
	name := stringOrEmpty(params, key)
	if strings.TrimSpace(name) == "" {
		return "", fmt.Errorf("%s is required", key)
	}
	return name, nil
}

func bindingArguments(params jsonObject) amqp.Table {
	arguments := amqp.Table{}
	if values := objectOrNil(params, "arguments"); values != nil {
		for key, value := range values {
			if converted := argumentValue(value); converted != nil {
				arguments[key] = converted
			}
		}
	}
	return arguments
}

func (s *server) listClientConnections(params jsonObject) (any, error) {
	connection, err := s.requireConnectionConfig(params)

View on GitHub (pinned to c0390bff16)

Solutions

  1. Provide non-empty 'source' and 'destination' in the bind/unbind call
  2. Trim/validate inputs at your API boundary before calling the driver
  3. Check which key is named in the error message and populate that specific field

Example fix

// before
await client.bind({"source": "  ", "destination": "orders", "destinationType": "queue"})
// after
await client.bind({"source": "events", "destination": "orders", "destinationType": "queue"})
Defensive patterns

Strategy: validation

Validate before calling

function requireFields(obj, keys) {
  for (const k of keys) {
    if (typeof obj[k] !== "string" || obj[k].trim() === "") {
      throw new Error(`${k} is required`)
    }
  }
}
// requireFields(params, ["source", "destination"])

Type guard

function hasBindingNames(p) {
  return typeof p.source === "string" && p.source.trim() !== "" &&
         typeof p.destination === "string" && p.destination.trim() !== ""
}

Try / catch

try {
  await client.bind(params)
} catch (e) {
  const m = /(.+) is required/.exec(String(e.message))
  if (m) { throw new Error(`binding config incomplete: set '${m[1]}'`) }
  throw e
}

Prevention

When it happens

Trigger: Calling bind or unbind without 'source' or 'destination', or with a whitespace-only value for those keys.

Common situations: Programmatic request builders omitting optional-looking fields, form/UI input allowing blank values, string interpolation producing empty strings.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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