From 5cb5bc03ebc210bf9b534ef647fe1d31c2f208ad Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Nov 2026 18:43:07 +1100 Subject: [PATCH] [UI] Improve error messaging for API fields (#13254) (#13255) - Handle condition where an API field has the same name as one of the "backup" catch-all fields (cherry picked from commit c80090b3ce33204bbf0255c1d5edcfa3c7e37f0b) Co-authored-by: Oliver --- src/frontend/src/components/forms/ApiForm.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/forms/ApiForm.tsx b/src/frontend/src/components/forms/ApiForm.tsx index 687b4bdec3..277f2a0d95 100644 --- a/src/frontend/src/components/forms/ApiForm.tsx +++ b/src/frontend/src/components/forms/ApiForm.tsx @@ -654,12 +654,6 @@ export function ApiForm({ for (const [k, v] of Object.entries(errors)) { const path = _path ? `${_path}.${k}` : k; - // Known error keys are displayed as non-field errors - if (NON_FIELD_ERROR_KEYS.includes(k)) { - processErrors(v); - continue; - } - // Nested errors (below the top level) cannot be mapped to a form field, // so they are displayed as non-field errors rather than being dropped if (_path) { @@ -669,6 +663,13 @@ export function ApiForm({ const field = fields[k]; + // Known error keys are displayed as non-field errors, + // unless the key matches a form field (e.g. a "reason" field) + if (!field && NON_FIELD_ERROR_KEYS.includes(k)) { + processErrors(v); + continue; + } + // Ignore top-level keys which do not correspond to a form field // (e.g. response metadata such as "transition" or "state") if (!field) {