Hmbown/CodeWhale · error · ValueError
provider!() invocations returned no providers
Error message
provider!() invocations returned no providers
What it means
provider_kind_ids() finishes by asserting it actually extracted at least one variant→id pair from the provider!() invocations. This error means the regex found zero provider!() calls, i.e. the function read a source where the registry macro invocations are absent entirely — the guard is reading the wrong file or the registry format changed wholesale.
Solutions
- Point the guard's source path (PROVIDER_RS / config source) at the file that actually contains the provider!() invocations
- Update the provider!() regex in provider_kind_ids to match the current macro call format
- Verify the repository checkout is complete and the registry file is non-empty before running the guard
Example fix
// before: PROVIDER_RS points to old config/providers.rs (moved in split) // after: PROVIDER_RS = REPO / "crates" / "config" / "src" / "provider_kind.rs" (or the file now holding provider!() calls)
Defensive patterns
Strategy: validation
Validate before calling
import re
if not re.findall(r'provider!\(', provider_rs):
print("no provider!() invocations found; check source path") Try / catch
try:
ids = provider_kind_ids(provider_rs)
except ValueError as e:
print(f"registry source unusable: {e}", file=sys.stderr)
sys.exit(1) Prevention
- Keep the guard's source path constants updated after module moves
- Verify the registry file exists and is non-empty before scanning
- Update the provider!() regex when macro call syntax changes
When it happens
Trigger: Called from api_provider_ids or main when re.findall over the source for provider!(...) invocations returns nothing — the file passed for provider_rs has no matching invocations (wrong path, empty read, or macro call format no longer matches the regex).
Common situations: The config module split moved provider registrations to a different file and the guard's path constant is stale; the provider! macro call syntax changed (different arg layout/whitespace); running the script from a checkout where the registry file is empty or missing.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- : missing parse arm for
- expected a hand-written `impl Provider for
- : missing
- could not parse match block after
- baseline receipt does not match baseline_observation
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/f1ac2e6d7c75698a.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/check-provider-registry.py:203
# the wire policy is not fixed, so provider!() cannot express them.
("ModelstudioTokenPlan", "modelstudio-token-plan"),
("ModelstudioTokenPlanAnthropic", "modelstudio-token-plan-anthropic"),
("ModelstudioCodingPlan", "modelstudio-coding-plan"),
("ModelstudioCodingPlanAnthropic", "modelstudio-coding-plan-anthropic"),
]:
match = re.search(
rf'impl\s+Provider\s+for\s+{variant_name}.*?fn\s+id.*?\"({id_literal})\"',
provider_rs, re.DOTALL,
)
if match:
ids[variant_name] = match.group(1)
elif variant_name not in ids:
raise ValueError(
f"expected a hand-written `impl Provider for {variant_name}` "
f"with id {id_literal!r}; the guard's floor is stale"
)
if not ids:
raise ValueError("provider!() invocations returned no providers")
return ids
def provider_kind_catalog_ids(
provider_kind_rs: str, variant_to_id: dict[str, str]
) -> set[str]:
catalog = re.search(
r"pub const ALL:\s*\[Self;\s*\d+\]\s*=\s*\[(.*?)\];",
provider_kind_rs,
flags=re.DOTALL,
)
if catalog is None:
raise ValueError("crates/config/src/provider_kind.rs: missing ProviderKind::ALL")
variants = set(re.findall(r"Self::(\w+)", catalog.group(1)))
catalog_variant_to_id = {**variant_to_id, "Custom": "custom"}
missing = variants - set(catalog_variant_to_id)
if missing:
raise ValueError(f"ProviderKind::ALL uses unknown variants: {sorted(missing)}")View on GitHub (pinned to 433685b202)