Hmbown/CodeWhale · error · ValueError
{context}: missing parse arm for {variant}
Error message
{context}: missing parse arm for {variant} What it means
parse_aliases_for_variant could not find a parse arm mapping string literals to the requested enum variant: neither a `"..." => Some(Self::Variant)` pattern inside the enum's `parse` match, nor (for ProviderKind/ApiProvider) a matching provider!() macro invocation in crates/config/src/provider.rs. The checker uses these arms to verify documented aliases, so a variant without a string-parseable identity is treated as a registry inconsistency.
Source
Thrown at scripts/check-provider-registry.py:136
match_arm = re.search(
rf'((?:"[^"]+"\s*\|\s*)*"[^"]+")\s*=>\s*Some\(Self::{variant}\)',
block,
)
if match_arm:
return set(re.findall(r'"([^"]+)"', match_arm.group(1)))
if enum_name in {"ProviderKind", "ApiProvider"}:
provider_rs = read(PROVIDER_RS)
provider_macro = re.search(
rf'provider!\(\s*\n\s*\w+,\s*\n\s*{variant},\s*\n\s*"([^"]+)".*?'
r"aliases:\s*\[(.*?)\]\s*\);",
provider_rs,
re.DOTALL,
)
if provider_macro:
return {provider_macro.group(1)} | set(
re.findall(r'"([^"]+)"', provider_macro.group(2))
)
raise ValueError(f"{context}: missing parse arm for {variant}")
def provider_kind_ids(config_rs: str) -> dict[str, str]:
provider_rs = read(PROVIDER_RS)
pairs = re.findall(
r"provider!\(\s*\n\s*\w+,\s*\n\s*(\w+),\s*\n\s*\"([^\"]+)\"",
provider_rs,
)
ids: dict[str, str] = {variant: provider_id for variant, provider_id in pairs}
# Providers with non-fixed wire policy or custom auth behavior use manual
# impls rather than the provider!() macro.
for variant_name, id_literal in [
("Deepseek", "deepseek"),
("DeepseekAnthropic", "deepseek-anthropic"),
("OpenaiCodex", "openai-codex"),
("Anthropic", "anthropic"),
("Openmodel", "openmodel"),
("MinimaxAnthropic", "minimax-anthropic"),View on GitHub (pinned to 8880682c63)
Solutions
- Add the missing arm to the enum's parse function: `"the-id" | "alias" => Some(Self::Variant)` (for ProviderKind this lives in crates/config/src/provider_kind.rs)
- Or add a provider!() invocation for the variant in crates/config/src/provider.rs with the id string and aliases list, which the checker also reads
- Keep arms as plain string-literal patterns — guards or `_ =>` fallbacks are invisible to the check
- Update the regexes in parse_aliases_for_variant if the macro shape legitimately changed
Example fix
// before: ProviderKind::Newprovider exists but parse() has no arm for it // after (crates/config/src/provider_kind.rs, inside parse) "newprovider" | "new-provider" => Some(Self::Newprovider),
Defensive patterns
Strategy: try-catch
Validate before calling
assert re.search(r'=>\s*Some\(Self::Newprovider\)', provider_kind_rs), 'missing parse arm for Newprovider'
Try / catch
try:
aliases = parse_aliases_for_variant(...)
except ValueError as e:
if 'missing parse arm' in str(e):
add_parse_arm(e)
raise Prevention
- Every new enum variant needs a string-literal parse arm
- Onboard providers through provider!() so the checker sees id and aliases
- Run the drift check in CI on changes to config and agent crates
When it happens
Trigger: Adding a new ProviderKind/ApiProvider variant without a parse arm; renaming a variant without updating parse; writing the arm with match guards, wildcards, or intermediate bindings the regex cannot match; changing the provider!() macro's argument shape so the fallback lookup misses too.
Common situations: New-provider onboarding done in the registry but not the parser; refactors of the parse function to data-driven lookups.
Related errors
- provider!() invocations returned no providers
- ModelRegistry uses unknown provider variants: {sorted(missin
- could not parse match block after {signature!r}
- ProvidersToml returned no provider tables
- no default provider model/base URL constants found
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/49797669f7b6ec2b.
Report an issue: GitHub.