{"record":{"id":"ece39ff8024f843b","repo":"t8y2/dbx","slug":"name-is-required-ece39f","errorCode":null,"errorMessage":"name is required","messagePattern":"name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/operations.go","lineNumber":453,"sourceCode":"\tbody := jsonObject{\n\t\t\"type\":        exchangeType,\n\t\t\"durable\":     boolOrDefault(params, \"durable\", true),\n\t\t\"auto_delete\": boolOrDefault(params, \"autoDelete\", false),\n\t}\n\tif _, err := managementSend(connection, http.MethodPut,\n\t\t\"/api/exchanges/\"+urlEncodeVhost(vhost)+\"/\"+urlEncodePathSegment(name), body); err != nil {\n\t\treturn nil, err\n\t}\n\treturn okResult(), nil\n}\n\nfunc (s *server) deleteExchange(params jsonObject) (any, error) {\n\tname := stringOrEmpty(params, \"name\")\n\tif err := assertExchangeDeletable(name); err != nil {\n\t\treturn nil, err\n\t}\n\tif strings.TrimSpace(name) == \"\" {\n\t\treturn nil, errors.New(\"name is required\")\n\t}\n\tconnection, err := s.requireConnectionConfig(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvhost := effectiveVhost(params, connection)\n\tif _, err := managementSend(connection, http.MethodDelete,\n\t\t\"/api/exchanges/\"+urlEncodeVhost(vhost)+\"/\"+urlEncodePathSegment(name), nil); err != nil {\n\t\treturn nil, err\n\t}\n\treturn okResult(), nil\n}\n\nfunc exchangeName(params jsonObject) (string, error) {\n\tname := stringOrEmpty(params, \"name\")\n\tif strings.TrimSpace(name) == \"\" {\n\t\treturn \"\", errors.New(\"name is required\")\n\t}","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/operations.go#L435-L471","documentation":"deleteExchange validates that an exchange 'name' was provided before issuing the DELETE /api/exchanges request. This error is thrown when the name is missing or whitespace-only. Note assertExchangeDeletable runs first, so blank names surface as whichever guard fires; the driver still requires a concrete exchange name.","triggerScenarios":"Calling deleteExchange without params[\"name\"], or with name:\"\" or \"   \", on a connected RabbitMQ server instance.","commonSituations":"Deleting exchanges from a list where an entry lacked a name field; UI passing an empty selection; confusable param names ('exchange' vs 'name'); copy-paste from deleteQueue examples missing the key.","solutions":["Pass {\"name\": \"my-exchange\"} (and, if needed, 'vhost' and 'destinationType' per your driver's contract) when calling deleteExchange.","Validate non-empty name at the call site before invoking the driver.","Confirm you are using the parameter name the dispatch contract expects — inspect the dispatch switch in operations.go for the accepted keys."],"exampleFix":"// before\nserver.Call(\"deleteExchange\", map[string]any{\"exchange\": \"logs\"})\n// after\nserver.Call(\"deleteExchange\", map[string]any{\"name\": \"logs\"})","handlingStrategy":"validation","validationCode":"func requireExchangeName(params map[string]any) error {\n    name, _ := params[\"name\"].(string)\n    if strings.TrimSpace(name) == \"\" {\n        return errors.New(\"caller validation: deleteExchange requires a non-empty 'name'\")\n    }\n    return nil\n}","typeGuard":"func hasExchangeName(params map[string]any) bool {\n    name, ok := params[\"name\"].(string)\n    return ok && strings.TrimSpace(name) != \"\"\n}","tryCatchPattern":"_, err := server.Call(\"deleteExchange\", params)\nif err != nil {\n    if err.Error() == \"name is required\" {\n        return fmt.Errorf(\"deleteExchange requires params.name; got %v\", params[\"name\"])\n    }\n    return err\n}","preventionTips":["Use the exact key 'name' when calling deleteExchange.","Normalize exchange records so the name field is always populated before deletion.","Skip or log entries with empty names instead of passing them through.","Add a shared params validator for all delete* operations in your calling code."],"tags":["rabbitmq","validation","missing-parameter","exchange"],"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"}