apache/superset · error
clientError.message || clientError.error || t('Sorry, an…
Error message
clientError.message || clientError.error || t('Sorry, an error occurred') What it means
Thrown by getDatasourceSamples' catch block in chartAction.ts when the POST to /datasource/samples fails. getClientErrorObject extracts the server's message/error field from the failed response; if neither exists, the generic 'Sorry, an error occurred' text is used, with the original error attached as cause. The thrown message is therefore whatever the backend reported.
Solutions
- Read err.cause and the network response for the backend's specific message — this error is a wrapper, the root cause is attached.
- Verify the database connection works (Settings > Database > Test Connection) and the dataset still resolves.
- Check the requesting user's access to the datasource; log in as Admin to distinguish permissions from connectivity.
- If sampling times out, sample a narrower table or fix the source-database performance issue.
Example fix
// before
const samples = await getDatasourceSamples(...);
// after
try {
const samples = await getDatasourceSamples(...);
} catch (e) {
notify({ message: e instanceof Error ? e.message : 'sample fetch failed' });
console.error('sample error cause:', (e as Error).cause);
} Defensive patterns
Strategy: try-catch
Validate before calling
// Verify datasource is reachable before sampling:
const { json } = await SupersetClient.get({ endpoint: `/api/v1/dataset/${id}` });
if (!json?.result?.database?.id) throw new Error('dataset database missing'); Try / catch
try {
const rows = await getDatasourceSamples(...);
} catch (e) {
const reason = (e as Error)?.cause instanceof Error ? (e as Error).cause : e;
notify({ message: (e as Error).message });
logger.error('datasource samples failed', reason);
} Prevention
- Always read err.cause — the wrapper hides the server detail
- Test database connectivity from Superset when sampling suddenly fails
When it happens
Trigger: Requesting sample rows for a dataset and the endpoint failing — invalid datasource id/type, database unreachable, permission denied on the database/dataset, or SQL error while the backend executed the sample query.
Common situations: Dataset points at a dropped/moved database; credentials rotated on the source database; Gamma user without datasource access; very wide tables timing out during sampling.
Related errors
- clientError.message || clientError.error || t('Sorry, an…
- Connection failed, please check your connection settings
- Connection failed, please check your connection settings
- DAO datasource query source type is not supported
- Datasource does not exist
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/af41591e8fe423f7.
Report an issue: GitHub.
Appendix: source
Thrown at superset-frontend/src/components/Chart/chartAction.ts:1000
searchParams.dashboard_id = dashboardId;
}
if (isDefined(perPage) && isDefined(page)) {
searchParams.per_page = perPage;
searchParams.page = page;
}
const response = await SupersetClient.post({
endpoint: '/datasource/samples',
jsonPayload,
searchParams,
parseMethod: 'json-bigint',
});
return response.json.result;
} catch (err) {
const clientError = await getClientErrorObject(err);
throw new Error(
clientError.message || clientError.error || t('Sorry, an error occurred'),
{ cause: err },
);
}
};
View on GitHub (pinned to f4587218dd)