{"record":{"id":"abf7043f6e31b357","repo":"pytorch/pytorch","slug":"codeowners-line-number-invalid-taxonomy-entry","errorCode":null,"errorMessage":"{codeowners}:{line_number}: invalid taxonomy entry","messagePattern":"(.+?):(.+?): invalid taxonomy entry","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/codeowners/check_taxonomy.py","lineNumber":121,"sourceCode":"                owners = []\n                for field in fields[1:]:\n                    if field.startswith(\"#\"):\n                        break\n                    owners.append(field)\n                if not owners:\n                    raise ValueError(f\"{location}: active pattern has no owners\")\n                invalid_owners = [\n                    owner for owner in owners if not is_valid_owner(owner)\n                ]\n                if invalid_owners:\n                    raise ValueError(\n                        f\"{location}: invalid active owners: {', '.join(invalid_owners)}\"\n                    )\n            if pattern == \"/\" or any(character in pattern for character in \"*?[\\\\\"):\n                raise ValueError(f\"{location}: invalid taxonomy path: {pattern!r}\")\n            patterns.append(TaxonomyPattern(group, pattern[1:], line_number))\n        elif line and not line.startswith(\"#\"):\n            raise ValueError(f\"{codeowners}:{line_number}: invalid taxonomy entry\")\n\n    if not patterns:\n        raise ValueError(\"taxonomy section contains no patterns\")\n    return patterns, section_groups\n\n\ndef tracked_paths(repo: Path) -> list[str]:\n    \"\"\"List paths committed in HEAD, including submodule entries.\"\"\"\n    output = subprocess.run(\n        [\"git\", \"-C\", repo, \"ls-tree\", \"-r\", \"-z\", \"--name-only\", \"HEAD\"],\n        check=True,\n        capture_output=True,\n    ).stdout.decode()\n    return sorted(path for path in output.split(\"\\0\") if path)\n\n\ndef analyze(paths: list[str], patterns: list[TaxonomyPattern]) -> Report:\n    \"\"\"Measure coverage and verify that source order preserves specificity.\"\"\"","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/pytorch/pytorch/blob/dcd2ecae775af66439b7ede4e7a82540b058c59c/scripts/codeowners/check_taxonomy.py#L103-L139","documentation":"Thrown by parse_patterns in scripts/codeowners/check_taxonomy.py when a line inside the taxonomy section is neither a '# [group]' header, a '# /path' draft entry or '/path' active entry, nor a plain comment/blank. I.e. the line has content, does not start with '#', and does not start with '/' or '# /' — the parser has no category for it, so it rejects it with the file:line location.","triggerScenarios":"Leaving actual prose text or a raw owner list in the taxonomy section, e.g. a line 'owned by release team'. A line starting with text like 'NOTE: check with ops'. Any non-comment, non-path token inside the section boundaries.","commonSituations":"Editing CODEOWNERS and leaving notes inside the taxonomy section instead of as '#' comments. Merge-conflict markers ('<<<<<<< HEAD') surviving inside the section. Paste accidents.","solutions":["Prefix the line with '#' so it is treated as a comment, if it is a note","Remove the line if it is stray content or conflict markers","Move misplaced real CODEOWNERS content to the correct section outside the taxonomy markers"],"exampleFix":"# before (inside taxonomy section)\nNOTE: discuss with ops\n# after\n# NOTE: discuss with ops","handlingStrategy":"validation","validationCode":"def stray_lines_in_section(path: str) -> list[str]:\n    lines = open(path).read().splitlines()\n    start = lines.index(\"# Draft grouped review-surface definitions:\") + 1\n    bad = []\n    for i, line in enumerate(lines[start:], start + 1):\n        s = line.strip()\n        if s and not s.startswith(\"#\") and not s.startswith(\"/\"):\n            bad.append(f\"{i}: {s}\")\n    return bad","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Inside the taxonomy section, allow only blank lines, '# ...' comments, '# [...] ' headers, and path entries","Resolve merge conflicts fully; conflict markers inside the section trigger this error"],"tags":["codeowners","ci","configuration","valueerror"],"backgroundTag":null,"analyzedSha":"dcd2ecae775af66439b7ede4e7a82540b058c59c","analyzedAt":"2026-08-14T19:21:26.615Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}