SeleniumHQ/selenium · error · RuntimeError
Expected exactly one webref_cddl_extension use_repo block, f
Error message
Expected exactly one webref_cddl_extension use_repo block, found {count} What it means
Raised by update_module() in scripts/update_cddl.py when the regex substitution for the use_repo(webref_cddl_extension, ...) block in MODULE.bazel does not match exactly once. The regex searches for 'use_repo(\n webref_cddl_extension,\n.*?\n)'. If count != 1, the MODULE.bazel file either lacks this block entirely or has been modified to have zero or multiple matches.
Source
Thrown at scripts/update_cddl.py:197
f'_BIDI_SPEC_HTML_SHA256 = "{bidi_sha256}"',
"_BIDI_SPEC_HTML_SHA256 assignment",
)
BZL_FILE.write_text(content)
def update_module(repo_names):
content = MODULE_FILE.read_text()
repo_list = "\n".join(f' "{name}",' for name in sorted(repo_names))
new_block = f"use_repo(\n webref_cddl_extension,\n{repo_list}\n)"
content, count = re.subn(
r"use_repo\(\n webref_cddl_extension,\n.*?\n\)",
new_block,
content,
flags=re.S,
)
if count != 1:
raise RuntimeError(f"Expected exactly one webref_cddl_extension use_repo block, found {count}")
MODULE_FILE.write_text(content)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--commit", help="pin this exact webref commit instead of the branch tip")
parser.add_argument(
"--branch",
default="main",
help="webref branch to resolve when --commit is omitted (default: main)",
)
args = parser.parse_args()
commit = args.commit or resolve_commit(args.branch)
print(f"Pinning {REPO}@{commit}")
before = existing_repo_names(BZL_FILE.read_text())
View on GitHub (pinned to aa36b38e69)
Solutions
- Inspect MODULE.bazel to verify the use_repo(webref_cddl_extension, ...) block exists with the expected formatting.
- Restore MODULE.bazel from git (git checkout MODULE.bazel) if it was manually corrupted.
- If the block was intentionally reformatted, update the regex pattern in update_module() to match the new format.
- Ensure there is exactly one such block.
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
import re
content = open('MODULE.bazel').read()
matches = re.findall(r'use_repo\(\n webref_cddl_extension,\n.*?\n\)', content, flags=re.S)
if len(matches) != 1:
print(f'WARNING: found {len(matches)} use_repo(webref_cddl_extension) blocks, expected 1') Type guard
null
Try / catch
null
Prevention
- Do not reformat the use_repo(webref_cddl_extension, ...) block in MODULE.bazel — keep the exact indentation the script expects.
- Run update_cddl.py regularly to keep MODULE.bazel in sync.
- If reformating is necessary, update the regex in update_module() to match.
When it happens
Trigger: Running update_cddl.py when MODULE.bazel has been edited to remove, reformat, or duplicate the use_repo(webref_cddl_extension, ...) block. The regex is strict about the formatting (must start with 'use_repo(\n webref_cddl_extension,'), so any whitespace or formatting change breaks the match.
Common situations: Manual reformatting of MODULE.bazel (e.g., by a Bazel formatter or editor); the use_repo block was renamed or removed during a Bazel module migration; merge conflicts altered the block formatting; someone changed the indentation or added comments inside the block that break the regex.
Related errors
- Expected exactly one {where} in {BZL_FILE.name}, found {n}
- Failed to list {CDDL_PATH} at {commit}: HTTP {r.status}
- Failed to download {url}: HTTP {r.status}
- Failed to resolve {repo}@{branch}: HTTP {r.status}
- Download unavailable (HTTP {r.status}): {url}
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/3793689e2bdb1666.
Report an issue: GitHub.