apache/superset · error
clientError.message || clientError.error || t('Sorry, an err
Error message
clientError.message || clientError.error || t('Sorry, an error occurred') What it means
Thrown by useUnsavedChangesPrompt's handleSaveAndCloseModal when onSave rejects. getClientErrorObject pulls the message/error field out of the failed response; the original error is preserved as cause. The visible text is the backend's own message (e.g. validation failure while saving a chart/dashboard) or the fallback string.
Source
Thrown at superset-frontend/src/hooks/useUnsavedChangesPrompt/index.ts:66
const confirmNavigationRef = useRef<(() => void) | null>(null);
const unblockRef = useRef<() => void>(() => {});
const manualSaveRef = useRef(false); // Track if save was user-initiated (not via navigation)
const handleConfirmNavigation = useCallback(() => {
setShowModal(false);
confirmNavigationRef.current?.();
}, []);
const handleSaveAndCloseModal = useCallback(async () => {
try {
if (manualSaveOnUnsavedChanges) manualSaveRef.current = true;
await onSave();
setShowModal(false);
} catch (err) {
const clientError = await getClientErrorObject(err);
throw new Error(
clientError.message ||
clientError.error ||
t('Sorry, an error occurred'),
{ cause: err },
);
}
}, [manualSaveOnUnsavedChanges, onSave]);
const triggerManualSave = useCallback(() => {
manualSaveRef.current = true;
onSave();
}, [onSave]);
const blockCallback = useCallback(
(
{
pathname,
search,View on GitHub (pinned to f4587218dd)
Solutions
- Inspect err.cause / the network response body for the specific validation message and fix the flagged field.
- Re-authenticate if status was 401, then retry the save from the modal.
- If the object's ownership/permissions changed, have an Admin restore the user's rights before saving.
- Keep a manual copy of edits (the modal stays open on failure) before reloading the page.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await handleSaveAndClose();
} catch (e) {
const detail = (e as Error)?.cause instanceof Error ? String((e as Error).cause) : '';
notify({ message: (e as Error).message, description: detail });
// modal stays open; user can retry or copy edits
} Prevention
- Keep the modal open on save failure so edits are not lost
- Log e.cause to capture the backend validation message
- Refresh sessions on long-lived edit pages
When it happens
Trigger: User clicks 'Save and close' on the unsaved-changes modal and the save request fails — chart/dashboard validation errors (40x), session expiry (401), a name collision, or backend 5xx during the PUT/POST.
Common situations: Saving a chart with params the API rejects; expired session after sitting on an edit page; backend restart mid-save; permission loss on the object (owner changed).
Related errors
- clientError.message || clientError.error || t('Sorry, an err
- Received unexpected response status (${response.status}) whi
- Export failed: ${response.status} ${response.statusText}
- Received unexpected response status (${response.status}) whi
- Received unexpected response status (${response.status}) whi
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/f3b4eff49b787a96.
Report an issue: GitHub.