{"record":{"id":"54010066928813fc","repo":"t8y2/dbx","slug":"addresses-is-required","errorCode":null,"errorMessage":"addresses is required","messagePattern":"addresses is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"agents/drivers/rabbitmq/main.go","lineNumber":352,"sourceCode":"\t\t_ = connection.Close()\n\t}\n}\n\nfunc openConnection(config jsonObject) (*amqp.Connection, error) {\n\taddresses, err := resolveAddresses(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar lastError error\n\tfor _, endpoint := range addresses {\n\t\tconnection, dialError := dialAddress(config, endpoint)\n\t\tif dialError == nil {\n\t\t\treturn connection, nil\n\t\t}\n\t\tlastError = dialError\n\t}\n\tif lastError == nil {\n\t\treturn nil, errors.New(\"addresses is required\")\n\t}\n\treturn nil, lastError\n}\n\nfunc dialAddress(config jsonObject, endpoint address) (*amqp.Connection, error) {\n\tproperties := objectOrNil(config, \"properties\")\n\tconnectOverride, err := endpointOverride(config, \"connect_override\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconnectionTimeout := durationMilliseconds(config, \"request_timeout_ms\", defaultRequestTimeout)\n\tif configured, ok := integerProperty(properties, \"connection_timeout_ms\"); ok {\n\t\tconnectionTimeout = time.Duration(configured) * time.Millisecond\n\t}\n\thandshakeTimeout := defaultHandshakeTimeout\n\tif configured, ok := integerProperty(properties, \"handshake_timeout_ms\"); ok {\n\t\thandshakeTimeout = time.Duration(configured) * time.Millisecond\n\t}","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/main.go#L334-L370","documentation":"openConnection iterates over resolved address candidates; if no candidate was resolved at all (lastError == nil), it means the connection config contained no usable addresses, so the driver throws this error instead of a dial error.","triggerScenarios":"Calling connect/testConnection (or anything that dials: channelFor, primaryChannel, peekMessages) with a config where no addresses could be resolved — reaching openConnection with an empty candidate list.","commonSituations":"Empty or whitespace-only 'addresses'/'host' config value that slipped past earlier checks; config built dynamically where the host key is present but blank; environment-specific config missing the broker host.","solutions":["Set a non-empty 'addresses' value in the connection config","Or set 'host' (with optional 'port') as a fallback","Validate the config (addresses/host present) before calling connect"],"exampleFix":"// before\nconfig := map[string]any{\"vhost\": \"prod\"}\nconn, err := agent.Connect(config)\n// after\nconfig := map[string]any{\"addresses\": \"rabbit1:5672,rabbit2:5672\", \"vhost\": \"prod\"}\nconn, err := agent.Connect(config)","handlingStrategy":"validation","validationCode":"addrs := strings.TrimSpace(cfg[\"addresses\"])\nif addrs == \"\" { addrs = strings.TrimSpace(cfg[\"host\"]) }\nif addrs == \"\" { return errors.New(\"connection config needs 'addresses' or 'host'\") }","typeGuard":"func hasEndpoint(cfg map[string]any) bool {\n\tfor _, k := range []string{\"addresses\", \"host\"} {\n\t\tif s, ok := cfg[k].(string); ok && strings.TrimSpace(s) != \"\" { return true }\n\t}\n\treturn false\n}","tryCatchPattern":"conn, err := agent.Connect(cfg)\nif err != nil && strings.Contains(err.Error(), \"addresses is required\") {\n\treturn fmt.Errorf(\"rabbitmq config incomplete: set addresses or host (env: RABBITMQ_ADDRESSES)\")\n}","preventionTips":["Validate connection config at process startup","Source addresses from env with a sane default (e.g. localhost:5672)","Log the resolved config (minus secrets) when connecting"],"tags":["rabbitmq","connection","missing-config"],"backgroundTag":"missing-required-parameter","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}