{"record":{"id":"057519a8329ca9fb","repo":"fluent/fluentd","slug":"bug-socket-option-is-available-only-for-udp","errorCode":null,"errorMessage":"BUG: socket option is available only for udp","messagePattern":"BUG: socket option is available only for udp","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin_helper/server.rb","lineNumber":131,"sourceCode":"      # server_create(:title, @port) do |data|\n      #   # ...\n      # end\n      # server_create(:title, @port) do |data, conn|\n      #   # ...\n      # end\n      # server_create(:title, @port, proto: :udp, max_bytes: 2048) do |data, sock|\n      #   sock.remote_host\n      #   sock.remote_port\n      #   # ...\n      # end\n      def server_create(title, port, proto: nil, bind: '0.0.0.0', shared: true, socket: nil, backlog: nil, tls_options: nil, max_bytes: nil, flags: 0, **socket_options, &callback)\n        proto ||= (@transport_config && @transport_config.protocol == :tls) ? :tls : :tcp\n\n        raise ArgumentError, \"BUG: title must be a symbol\" unless title && title.is_a?(Symbol)\n        raise ArgumentError, \"BUG: port must be an integer\" unless port && port.is_a?(Integer)\n        raise ArgumentError, \"BUG: invalid protocol name\" unless PROTOCOLS.include?(proto)\n\n        raise ArgumentError, \"BUG: socket option is available only for udp\" if socket && proto != :udp\n        raise ArgumentError, \"BUG: tls_options is available only for tls\" if tls_options && proto != :tls\n\n        raise ArgumentError, \"BUG: block not specified which handles received data\" unless block_given?\n        raise ArgumentError, \"BUG: block must have 1 or 2 arguments\" unless callback.arity == 1 || callback.arity == 2\n\n        if proto == :tcp || proto == :tls\n          socket_options[:linger_timeout] ||= @transport_config&.linger_timeout || 0\n        end\n\n        socket_options[:receive_buffer_size] ||= @transport_config&.receive_buffer_size\n\n        unless socket\n          socket_option_validate!(proto, **socket_options)\n          socket_option_setter = ->(sock){ socket_option_set(sock, **socket_options) }\n        end\n\n        if proto != :tcp && proto != :tls && proto != :unix # options to listen/accept connections\n          raise ArgumentError, \"BUG: backlog is available for tcp/tls\" if backlog","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin_helper/server.rb#L113-L149","documentation":"Error \"BUG: socket option is available only for udp\" thrown in fluent/fluentd.","triggerScenarios":"Thrown at lib/fluent/plugin_helper/server.rb:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}