fix(ui): title validation errors correctly instead of Rate Limit Exceeded

The /model/new endpoint returns a 400 validation error (type: validation_error)
when 'rpm and tpm must be set to a positive value when enforce_rpm_tpm_on_model_add
is enabled in general_settings' but the frontend's titleFor() keyword matcher
mistitled it as 'Rate Limit Exceeded' because the message contains 'rpm'/'tpm'
substrings, which matched the generic rate-limit keyword check before the more
specific validation check could catch it.

Add "'enforce_rpm_tpm_on_model_add' is enabled" to VALIDATION_MATCH so this
message is classified as a Validation Error, matching the actual HTTP 400
validation_error the backend already returns. A narrow match on the setting
name (rather than the generic "must be set when") avoids overriding the
status-based classification of unrelated 401s, e.g. the PKCE
'GENERIC_CLIENT_ID must be set when PKCE is enabled' error.
This commit is contained in:
Kunal Nayyar 2026-08-11 13:03:55 +05:30
parent 65eae963a7
commit 526fc9eab1

View file

@ -104,7 +104,7 @@ const VALIDATION_MATCH = [
"invalid file type",
"invalid field",
"invalid date format",
"must be set when",
"'enforce_rpm_tpm_on_model_add' is enabled",
];
const NOT_FOUND_MATCH = [