hermes - ✅(Solved) Fix Bug: ModelPickerDialog crashes with "re.toLowerCase is not a function" when typing in filter [3 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#23231Fetched 2026-05-11 03:30:24
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×3referenced ×1

Fix Action

Fixed

PR fix notes

PR #23261: fix(web): guard ModelPicker filter against non-string model entries (#23231)

Description (problem / solution / changelog)

Summary

  • Typing in the dashboard's Filter providers and models... input crashed ModelPickerDialog with TypeError: re.toLowerCase is not a function, blanking the dashboard.
  • Two filter callbacks at web/src/components/ModelPickerDialog.tsx:159 and :166 called m.toLowerCase() on every entry of provider.models without checking it was actually a string.

The bug

The TypeScript declaration is models?: string[], but the runtime data is fetched from a JSON-RPC model.options response (or the standalone REST loader) and assigned directly without validation:

const next = r?.providers ?? [];
setProviders(next);

When a provider yields a models array with null/undefined entries (one observed source: providers whose listing endpoint partially fails and falls back to a sentinel), m.toLowerCase() throws on the first non-string entry, the React render aborts, and the dashboard goes blank.

The fix

Add a typeof m === "string" guard before .toLowerCase() in both filter call sites. Skipping non-string entries is preferable to coercing them via String(m), which would let String(null) === "null" accidentally match a search for "null".

(p.models ?? []).some(
  (m) => typeof m === "string" && m.toLowerCase().includes(needle),
),
// and
models.filter(
  (m) => typeof m === "string" && m.toLowerCase().includes(needle),
),

Test plan

  • npx tsc -b clean — no type errors.
  • npx eslint src/components/ModelPickerDialog.tsx clean.
  • Manual logic check: typeof null === "object", typeof undefined === "undefined", typeof 123 === "number" — all short-circuit to false and are silently skipped; only string entries reach .toLowerCase().
  • No frontend test runner is configured in web/package.json, so no unit test added.

Sibling code paths that may need similar defensive normalization: the load site at web/src/components/ModelPickerDialog.tsx:104 (const next = r?.providers ?? []) trusts the JSON-RPC response shape without validation, so any other consumer of provider.models (e.g. counts, rendering) could also misbehave on non-string entries. Intentionally left out of this PR's scope to keep the diff small — happy to widen if preferred.

Related

  • Fixes #23231

Changed files

  • web/src/components/ModelPickerDialog.tsx (modified, +9/-2)

PR #23277: fix(web): tolerate non-string model picker entries

Description (problem / solution / changelog)

What does this PR do?

Fixes the web model picker crash when a provider returns a non-string entry in its models list. The filter path previously called .toLowerCase() directly on every entry, so null, numbers, or other non-string values could crash the dialog while typing.

This change normalizes values through String(...) only when they are non-null, which keeps the filter resilient without changing the picker flow.

Related Issue

Fixes #23231

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Updated web/src/components/ModelPickerDialog.tsx
  • Added a small matchesNeedle helper that safely normalizes unknown values before filtering
  • Replaced direct .toLowerCase() calls on provider/model entries with the safe matcher

How to Test

  1. Open the web model picker
  2. Use a provider payload that includes a non-string model entry
  3. Type into the filter and confirm the dialog no longer crashes

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15 / local web toolchain

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

  • pnpm exec eslint src/components/ModelPickerDialog.tsx
  • pnpm exec tsc -p tsconfig.app.json --noEmit

Changed files

  • web/src/components/ModelPickerDialog.tsx (modified, +12/-8)

PR #23338: fix(dashboard): guard ModelPickerDialog filter toLowerCase against nullish model names

Description (problem / solution / changelog)

Closes #23231

The model picker filter crashes when a model value in the list is null or undefined because "toLowerCase is not a function". This adds optional chaining to both the provider-models and flat-models filter paths.

Changed files

  • scripts/release.py (modified, +1/-0)
  • web/src/components/ModelPickerDialog.tsx (modified, +2/-2)
RAW_BUFFERClick to expand / collapse

fix: Crash w ModelPickerDialog przy wpisywaniu w filtr

Plik: web/src/components/ModelPickerDialog.tsx (linie 159 i 166)

Problem: Po wpisaniu tekstu w pole "Filter providers and models…" w dashboardzie (zakładka MODELS → CHANGE), strona crashuje do pustego tła. Błąd JS: TypeError: re.toLowerCase is not a function.

Przyczyna: Tablica models może zawierać wartości niebędące stringami (np. null, undefined), ale kod zakłada że każdy element jest stringiem i woła .toLowerCase() bez sprawdzenia.

Fix: Dodanie m && String(m).toLowerCase() zamiast m.toLowerCase() w dwóch miejscach:

Linia 159 — filtr providerów: (p.models ?? []).some(...) → m && String(m).toLowerCase().includes(needle)
Linia 166 — filtr modeli: models.filter(...) → m && String(m).toLowerCase().includes(needle)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Bug: ModelPickerDialog crashes with "re.toLowerCase is not a function" when typing in filter [3 pull requests, 1 participants]