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 scans the default provider model/base-URL constants (now in crates/tui/src/config/models.rs plus config.rs), skipping known non-provider constants (DEFAULT_DEEPSEEKCN_BASE_URL, DEFAULT_ANTIGRAVITY_*). If no constants survive the filters it raises this ValueError — an empty result means the source layout or naming convention changed and the check would compare nothing.

Solutions

  1. Confirm default model/base-URL constants still exist in crates/tui/src/config/models.rs (or config.rs) with the DEFAULT_ naming the script scans.
  2. If they moved, update TUI_CONFIG_MODELS_RS / the default_strings file list in scripts/check-provider-registry.py.
  3. If the naming convention changed, update the constant-extraction regex in default_strings.
  4. Check that the skip-filter (DEFAULT_DEEPSEEKCN_BASE_URL / DEFAULT_ANTIGRAVITY_ prefixes) is not excluding newly renamed constants unexpectedly.

Example fix

// before (config.rs)
pub const OPENAI_BASE: &str = "...";
// after (config/models.rs)
pub const DEFAULT_OPENAI_BASE_URL: &str = "...";
Defensive patterns

Strategy: validation

Validate before calling

import re
srcs = [open(p).read() for p in ("crates/tui/src/config/models.rs", "crates/tui/src/config.rs")]
defaults = re.findall(r"pub const (DEFAULT_[A-Z0-9_]+)\s*:\s*&str\s*=\s*\"([^\"]+)\"", "\n".join(srcs))
assert defaults, "no DEFAULT_* provider constants found"

Type guard

def default_constants_present(models_rs: str, config_rs: str) -> bool:
    text = models_rs + config_rs
    return bool(re.search(r"pub const DEFAULT_[A-Z0-9_]+\s*:\s*&str", text))

Try / catch

try:
    defaults = default_strings(models_src + config_src)
except ValueError as e:
    print(f"check aborted: {e}"); sys.exit(1)

Prevention

When it happens

Trigger: Running the check when no `pub const DEFAULT_*` string constants matching the script's expected pattern exist in crates/tui/src/config/models.rs or config.rs — constants renamed, moved to another module, or the skip-filter consumed everything.

Common situations: The constants module was moved again (e.g. into a provider-specific module) after the #3311 leaf split; constants renamed away from the DEFAULT_ prefix; the models.rs file was emptied during refactoring.

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


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/f4a1add1d6092126. Report an issue: GitHub.

Appendix: source

Thrown at scripts/check-provider-registry.py:550

    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" or name.startswith(
            "DEFAULT_ANTIGRAVITY_"
        ):
            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 433685b202)