Hmbown/CodeWhale · error · ValueError
no default provider model/base URL constants found
Error message
no default provider model/base URL constants found
What it means
default_strings found no `const DEFAULT_*_MODEL: &str = "..."` or `const DEFAULT_*_BASE_URL: &str = "..."` constants across crates/tui/src/config.rs and crates/tui/src/config/models.rs. Those constants are what the PROVIDERS.md drift check requires to appear as inline code spans, so zero matches means the check cannot run at all. The script already follows one historical move of these constants (#3311); any further move breaks it.
Source
Thrown at scripts/check-provider-registry.py:236
if missing:
raise ValueError(f"ModelRegistry uses unknown provider variants: {sorted(missing)}")
return {variant_to_id[variant] for variant in variants}
def default_strings(tui_config_rs: str) -> set[str]:
# Model/base-URL constants now live in config/models.rs (#3311); scan it
# alongside config.rs so the check follows the leaf split.
sources = tui_config_rs + "\n" + read(TUI_CONFIG_MODELS_RS)
defaults = set()
for name, value in re.findall(
r'const\s+(DEFAULT_[A-Z0-9_]+(?:MODEL|BASE_URL)):\s*&str\s*=\s*"([^"]+)"',
sources,
):
if name == "DEFAULT_DEEPSEEKCN_BASE_URL":
continue
defaults.add(value)
if not defaults:
raise ValueError("no default provider model/base URL constants found")
return defaults
def missing_default_strings(providers_md: str, defaults: set[str]) -> list[str]:
# Inline-code validation should not let fenced TOML/bash examples pair a
# stray backtick with later prose; strip fenced blocks before scanning.
inline_source = re.sub(r"```.*?```", "", providers_md, flags=re.DOTALL)
code_spans = set(re.findall(r"`([^`]+)`", inline_source))
return sorted(defaults - code_spans)
def report_set(label: str, expected: set[str], actual: set[str]) -> list[str]:
errors = []
missing = sorted(expected - actual)
extra = sorted(actual - expected)
if missing:
errors.append(f"{label} missing: {', '.join(missing)}")
if extra:View on GitHub (pinned to 8880682c63)
Solutions
- Locate where the DEFAULT_*_MODEL / DEFAULT_*_BASE_URL constants now live and update TUI_CONFIG_MODELS_RS (or add the new path) in scripts/check-provider-registry.py
- Keep the constants as &str literals named DEFAULT_<PROVIDER>_MODEL or DEFAULT_<PROVIDER>_BASE_URL
- Remember DEFAULT_DEEPSEEKCN_BASE_URL is intentionally excluded from the docs check; do not rename other constants into that shape to dodge the check
Example fix
# before (scripts/check-provider-registry.py) — constants moved to a new leaf module TUI_CONFIG_MODELS_RS = ROOT / 'crates' / 'tui' / 'src' / 'config' / 'models.rs' # after TUI_CONFIG_MODELS_RS = ROOT / 'crates' / 'tui' / 'src' / 'config' / 'defaults.rs'
Defensive patterns
Strategy: validation
Validate before calling
sources = tui_config_rs + '\n' + models_rs_text defaults = re.findall(r'const\s+(DEFAULT_[A-Z0-9_]+(?:MODEL|BASE_URL)):\s*&str\s*=\s*"([^"]+)"', sources) assert defaults, 'default constants moved or renamed — update the checker paths'
Prevention
- Update TUI_CONFIG_MODELS_RS whenever the default constants move
- Keep DEFAULT_*_MODEL / DEFAULT_*_BASE_URL naming with &str literal values
- Mention new default strings in docs/PROVIDERS.md as inline code spans
When it happens
Trigger: Moving the default model/base-URL constants to a new module without updating TUI_CONFIG_MODELS_RS; renaming constants away from the DEFAULT_*_MODEL / DEFAULT_*_BASE_URL pattern; changing the type away from a plain &str literal (for example concat! or env! macros).
Common situations: Further leaf splits of the tui config module; constant-cleanup renames; switching defaults to runtime configuration.
Related errors
- {context}: missing {needle!r}
- could not parse match block after {signature!r}
- {context}: missing parse arm for {variant}
- provider!() invocations returned no providers
- ProvidersToml returned no provider tables
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/f4a1add1d6092126.
Report an issue: GitHub.