{"record":{"id":"6d3cd8148446d49f","repo":"fluent/fluentd","slug":"implement-this-method-in-child-class","errorCode":null,"errorMessage":"Implement this method in child class","messagePattern":"Implement this method in child class","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin/parser.rb","lineNumber":144,"sourceCode":"                           else\n                             nil\n                           end\n      end\n\n      def start\n        super\n\n        @timeout_checker.start if @timeout_checker\n      end\n\n      def stop\n        super\n\n        @timeout_checker.stop if @timeout_checker\n      end\n\n      def parse(text, &block)\n        raise NotImplementedError, \"Implement this method in child class\"\n      end\n\n      def parse_with_timeout(text, &block)\n        @timeout_checker.execute {\n          parse_orig(text, &block)\n        }\n      rescue UncatchableError\n        log.warn \"parsing timed out with #{self.class}: text = #{text}\"\n        # Return nil instead of raising error. in_tail or other plugin can emit broken line.\n        yield nil, nil\n      end\n\n      def call(*a, &b)\n        # Keep backward compatibility for existing plugins\n        # TODO: warn when deprecated\n        parse(*a, &b)\n      end\n","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/parser.rb#L126-L162","documentation":"Fluent::Plugin::Parser#parse is an abstract method (lib/fluent/plugin/parser.rb:144) that only raises NotImplementedError; every concrete parser plugin (json, regexp, multiline, ...) must override it. The error means code is running the base-class implementation: either an abstract parser was instantiated or a custom parser subclass forgot to define #parse. It surfaces at the first parse call, not at configure time.","triggerScenarios":"Creating a parser with Fluent::Plugin.new_parser('mytype') where the registered plugin class does not define parse(text, &block); calling parser.call(text) (which delegates to parse for backward compatibility) on such a plugin; subclassing Fluent::Plugin::Parser in a gem but naming the method parse_line or giving it the wrong arity so the base method stays in the lookup path.","commonSituations":"Developing a custom parser plugin and misspelling/omitting #parse; registering the base class or a stub class by accident; in_tail/in_http configured with @type pointing to an incompletely implemented parser gem; version upgrades renaming expected method signatures.","solutions":["Implement def parse(text, &block) in your parser subclass that yields(time, record) — e.g. yield Fluent::EventTime.now, {'raw' => text}.","Verify the method exists before use: parser.class.instance_methods(false).include?(:parse).","Make sure the method accepts the text argument and uses yield (not return) to deliver results.","If you meant to use a built-in parser, instantiate the concrete type (json, regexp, none, ...) via Fluent::Plugin.new_parser."],"exampleFix":"# before\nclass MyParser < Fluent::Plugin::Parser\n  Fluent::Plugin.register_parser('mytype', self)\n  # no #parse -> NotImplementedError on first call\nend\n# after\nclass MyParser < Fluent::Plugin::Parser\n  Fluent::Plugin.register_parser('mytype', self)\n  def parse(text)\n    yield Fluent::EventTime.now, {'raw' => text}\n  end\nend","handlingStrategy":"validation","validationCode":"# fail fast at plugin load time instead of first parse\ndef assert_parser_implements_parse!(parser)\n  klass = parser.is_a?(Class) ? parser : parser.class\n  unless klass.instance_methods(false).include?(:parse)\n    raise \"parser #{klass} does not implement #parse\"\n  end\nend","typeGuard":null,"tryCatchPattern":"begin\n  parser.call(text) { |t, r| handle(t, r) }\nrescue NotImplementedError\n  log.error \"parser #{parser.class} is abstract; check @type\"\n  # fall back to a concrete parser, e.g. Fluent::Plugin.new_parser('none')\nend","preventionTips":["Smoke-test every custom parser with one call in its spec suite.","Instantiate parsers only via Fluent::Plugin.new_parser with a registered concrete type.","Name the method exactly 'parse' accepting text and yielding time/record."],"tags":["fluentd","parser-plugin","not-implemented","plugin-development"],"backgroundTag":"abstract-method-not-implemented","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}