{"record":{"id":"9b262aba6594bfd8","repo":"t8y2/dbx","slug":"s-is-required","errorCode":null,"errorMessage":"%s is required","messagePattern":"(.+?) is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/operations.go","lineNumber":600,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tif destinationType == \"queue\" {\n\t\tif bind {\n\t\t\treturn channel.QueueBind(destination, routingKey, source, false, arguments)\n\t\t}\n\t\treturn channel.QueueUnbind(destination, routingKey, source, arguments)\n\t}\n\tif bind {\n\t\treturn channel.ExchangeBind(destination, routingKey, source, false, arguments)\n\t}\n\treturn channel.ExchangeUnbind(destination, routingKey, source, false, arguments)\n}\n\nfunc requireBindingName(params jsonObject, key string) (string, error) {\n\tname := stringOrEmpty(params, key)\n\tif strings.TrimSpace(name) == \"\" {\n\t\treturn \"\", fmt.Errorf(\"%s is required\", key)\n\t}\n\treturn name, nil\n}\n\nfunc bindingArguments(params jsonObject) amqp.Table {\n\targuments := amqp.Table{}\n\tif values := objectOrNil(params, \"arguments\"); values != nil {\n\t\tfor key, value := range values {\n\t\t\tif converted := argumentValue(value); converted != nil {\n\t\t\t\targuments[key] = converted\n\t\t\t}\n\t\t}\n\t}\n\treturn arguments\n}\n\nfunc (s *server) listClientConnections(params jsonObject) (any, error) {\n\tconnection, err := s.requireConnectionConfig(params)","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/operations.go#L582-L618","documentation":"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.","triggerScenarios":"Calling bind or unbind without 'source' or 'destination', or with a whitespace-only value for those keys.","commonSituations":"Programmatic request builders omitting optional-looking fields, form/UI input allowing blank values, string interpolation producing empty strings.","solutions":["Provide non-empty 'source' and 'destination' in the bind/unbind call","Trim/validate inputs at your API boundary before calling the driver","Check which key is named in the error message and populate that specific field"],"exampleFix":"// before\nawait client.bind({\"source\": \"  \", \"destination\": \"orders\", \"destinationType\": \"queue\"})\n// after\nawait client.bind({\"source\": \"events\", \"destination\": \"orders\", \"destinationType\": \"queue\"})","handlingStrategy":"validation","validationCode":"function requireFields(obj, keys) {\n  for (const k of keys) {\n    if (typeof obj[k] !== \"string\" || obj[k].trim() === \"\") {\n      throw new Error(`${k} is required`)\n    }\n  }\n}\n// requireFields(params, [\"source\", \"destination\"])","typeGuard":"function hasBindingNames(p) {\n  return typeof p.source === \"string\" && p.source.trim() !== \"\" &&\n         typeof p.destination === \"string\" && p.destination.trim() !== \"\"\n}","tryCatchPattern":"try {\n  await client.bind(params)\n} catch (e) {\n  const m = /(.+) is required/.exec(String(e.message))\n  if (m) { throw new Error(`binding config incomplete: set '${m[1]}'`) }\n  throw e\n}","preventionTips":["Validate required binding fields before calling the driver","Trim inputs so whitespace-only values are caught early","Read the interpolated key name in the message to pinpoint the missing field"],"tags":["rabbitmq","validation","binding","missing-parameter"],"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-14T00:17:10.932Z"}