pytorch/pytorch · error · ValueError
{location}: active pattern has no owners
Error message
{location}: active pattern has no owners What it means
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.
Source
Thrown at scripts/codeowners/check_taxonomy.py:109
group = line[len(GROUP_PREFIX) : -1]
if group in section_groups:
raise ValueError(f"{codeowners}:{line_number}: repeated group: {group}")
section_groups.append(group)
elif line.startswith(("# /", "/")):
location = f"{codeowners}:{line_number}"
active = line.startswith("/")
fields = (line if active else line[2:]).split()
pattern = fields[0]
if group is None:
raise ValueError(f"{location}: pattern has no group")
if active:
owners = []
for field in fields[1:]:
if field.startswith("#"):
break
owners.append(field)
if not owners:
raise ValueError(f"{location}: active pattern has no owners")
invalid_owners = [
owner for owner in owners if not is_valid_owner(owner)
]
if invalid_owners:
raise ValueError(
f"{location}: invalid active owners: {', '.join(invalid_owners)}"
)
if pattern == "/" or any(character in pattern for character in "*?[\\"):
raise ValueError(f"{location}: invalid taxonomy path: {pattern!r}")
patterns.append(TaxonomyPattern(group, pattern[1:], line_number))
elif line and not line.startswith("#"):
raise ValueError(f"{codeowners}:{line_number}: invalid taxonomy entry")
if not patterns:
raise ValueError("taxonomy section contains no patterns")
return patterns, section_groups
View on GitHub (pinned to dcd2ecae77)
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
Example fix
# before /torch/nn/ # TODO assign # after /torch/nn/ @pytorch/core # TODO assign
Defensive patterns
Strategy: validation
Validate before calling
def active_patterns_have_owners(path: str) -> list[str]:
problems = []
for i, line in enumerate(open(path).read().splitlines(), 1):
s = line.strip()
if s.startswith("/") and not s.startswith("# "):
fields = s.split()
owners = []
for f in fields[1:]:
if f.startswith("#"):
break
owners.append(f)
if not owners:
problems.append(f"line {i}: {s}")
return problems Prevention
- Every active '/' rule must list at least one owner before any trailing '#comment'
- Prefer draft '# /path' entries until owners are decided
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- missing review-surface hierarchy or rules marker
- duplicate hierarchy surfaces: {', '.join(duplicates)}
- review-surface hierarchy contains no surfaces
- missing taxonomy marker: {SECTION_MARKER}
- {codeowners}:{line_number}: repeated group: {group}
AI-assisted analysis of pytorch/pytorch@dcd2ecae77 (2026-08-14).
Data as JSON: /api/errors/320e0b085a8b8a66.
Report an issue: GitHub.