{"record":{"id":"320e0b085a8b8a66","repo":"pytorch/pytorch","slug":"location-active-pattern-has-no-owners","errorCode":null,"errorMessage":"{location}: active pattern has no owners","messagePattern":"(.+?): active pattern has no owners","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/codeowners/check_taxonomy.py","lineNumber":109,"sourceCode":"            group = line[len(GROUP_PREFIX) : -1]\n            if group in section_groups:\n                raise ValueError(f\"{codeowners}:{line_number}: repeated group: {group}\")\n            section_groups.append(group)\n        elif line.startswith((\"# /\", \"/\")):\n            location = f\"{codeowners}:{line_number}\"\n            active = line.startswith(\"/\")\n            fields = (line if active else line[2:]).split()\n            pattern = fields[0]\n            if group is None:\n                raise ValueError(f\"{location}: pattern has no group\")\n            if active:\n                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","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/pytorch/pytorch/blob/dcd2ecae775af66439b7ede4e7a82540b058c59c/scripts/codeowners/check_taxonomy.py#L91-L127","documentation":"Thrown by parse_patterns in scripts/codeowners/check_taxonomy.py when an ACTIVE taxonomy pattern (a line starting with '/', i.e. live in the real CODEOWNERS section rather than a commented '# /' draft entry) has no owner fields after the pattern. Active CODEOWNERS rules must list at least one owner; the fields after the path are collected up to a trailing '#comment' and an empty list triggers this error with file:line location.","triggerScenarios":"Writing a raw rule line '/torch/nn/' with nothing after it inside the taxonomy section. A line like '/build/ # handled by release team' where everything after the path is a comment, leaving zero owners.","commonSituations":"Copying a commented draft line and uncommenting it but not adding owners. Trailing-comment conventions ('everything after # is ignored') accidentally consuming what was meant to be an owner. Reformatting that separates pattern from owners with a comment.","solutions":["Add at least one valid owner (e.g. @pytorch/core or team/user handle) after the pattern, before any trailing comment","If the rule is still a draft, keep it commented with the '# /' prefix","If the rule is obsolete, delete the line entirely"],"exampleFix":"# before\n/torch/nn/ # TODO assign\n# after\n/torch/nn/ @pytorch/core # TODO assign","handlingStrategy":"validation","validationCode":"def active_patterns_have_owners(path: str) -> list[str]:\n    problems = []\n    for i, line in enumerate(open(path).read().splitlines(), 1):\n        s = line.strip()\n        if s.startswith(\"/\") and not s.startswith(\"# \"):\n            fields = s.split()\n            owners = []\n            for f in fields[1:]:\n                if f.startswith(\"#\"):\n                    break\n                owners.append(f)\n            if not owners:\n                problems.append(f\"line {i}: {s}\")\n    return problems","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Every active '/' rule must list at least one owner before any trailing '#comment'","Prefer draft '# /path' entries until owners are decided"],"tags":["codeowners","ci","configuration","ownership","valueerror"],"backgroundTag":null,"analyzedSha":"dcd2ecae775af66439b7ede4e7a82540b058c59c","analyzedAt":"2026-08-14T19:21:26.615Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}