{"record":{"id":"2e4b931843ff4977","repo":"netdata/netdata","slug":"expected-the-node-content-but-found-r","errorCode":null,"errorMessage":"expected the node content, but found %r","messagePattern":"expected the node content, but found %r","errorType":"exception","errorClass":"ParserError","httpStatus":null,"severity":"error","filePath":"src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py","lineNumber":370,"sourceCode":"                    self.state = self.parse_block_sequence_first_entry\n                elif block and self.check_token(BlockMappingStartToken):\n                    end_mark = self.peek_token().start_mark\n                    event = MappingStartEvent(anchor, tag, implicit,\n                            start_mark, end_mark, flow_style=False)\n                    self.state = self.parse_block_mapping_first_key\n                elif anchor is not None or tag is not None:\n                    # Empty scalars are allowed even if a tag or an anchor is\n                    # specified.\n                    event = ScalarEvent(anchor, tag, (implicit, False), '',\n                            start_mark, end_mark)\n                    self.state = self.states.pop()\n                else:\n                    if block:\n                        node = 'block'\n                    else:\n                        node = 'flow'\n                    token = self.peek_token()\n                    raise ParserError(\"while parsing a %s node\" % node, start_mark,\n                            \"expected the node content, but found %r\" % token.id,\n                            token.start_mark)\n        return event\n\n    # block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END\n\n    def parse_block_sequence_first_entry(self):\n        token = self.get_token()\n        self.marks.append(token.start_mark)\n        return self.parse_block_sequence_entry()\n\n    def parse_block_sequence_entry(self):\n        if self.check_token(BlockEntryToken):\n            token = self.get_token()\n            if not self.check_token(BlockEntryToken, BlockEndToken):\n                self.states.append(self.parse_block_sequence_entry)\n                return self.parse_block_node()\n            else:","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/netdata/netdata/blob/4864de85e26f6734d92cfc27ccbeff5921f49938/src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py#L352-L388","documentation":"ParserError raised by parse_node when a property (anchor '&' or tag '!') has been consumed but the token that follows cannot start node content in that position — e.g. a flow separator ',' or '}' directly after a tag, or a block-entry '-' on the same line after a tag. The parser expected a scalar/collection to attach the properties to.","triggerScenarios":"yaml.safe_load() on input like '{a: !str, b: 1}' (tag then ','), 'k: !!str - item' (tag and sequence entry on one line), or a dangling 'k: !tag' followed by a token that is not a value in that context.","commonSituations":"Fixing a value's type by adding '!!str'/'!!int' in the wrong place; writing a tagged block sequence on a single line; leftover anchors/tags after deleting a value.","solutions":["Put the node the tag applies to immediately after it: 'k: !!str \"12\"'.","For block collections, start the sequence on the next line: 'k: !!seq' followed by an indented '- item'.","Remove the stray '&'/'!' property if the value was deleted.","Re-run yaml.safe_load() to verify."],"exampleFix":"# before\nkey: !!str - item\n\n# after\nkey: !!str \"item\"","handlingStrategy":"try-catch","validationCode":"import re, yaml\n\ndef tags_attached_to_nodes(text):\n    # a property immediately followed by a flow separator is dangling\n    bad = [i + 1 for i, l in enumerate(text.splitlines())\n           if re.search(r'(!!?\\S+|&\\w+)\\s*[,\\]}]', l)]\n    return not bad","typeGuard":"def is_node_content_error(exc):\n    return isinstance(exc, yaml.parser.ParserError) and 'expected the node content' in str(exc)","tryCatchPattern":"try:\n    cfg = yaml.safe_load(text)\nexcept yaml.parser.ParserError as e:\n    if 'expected the node content' in str(e):\n        report('a tag/anchor must be immediately followed by its node value')","preventionTips":["Place tags directly before the scalar/collection they annotate.","Start tagged block collections on the next line.","Delete dangling '&'/'!' properties when removing values."],"tags":["yaml","python","tags","anchors","parsing"],"backgroundTag":null,"analyzedSha":"4864de85e26f6734d92cfc27ccbeff5921f49938","analyzedAt":"2026-08-15T09:12:38.226Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}