GitHub user FrancescoCastaldi added a comment to the discussion: Failed to save 
slice for visualisations

The error "Failed to save slice" when tabular charts save successfully but 
visualization charts fail typically points to payload validation errors during 
the `POST /api/v1/chart/` call, rather than a database connection failure.

Here is why this happens and how to resolve it:

### 1. Identify the Exact Validation Error in Browser DevTools
When the backend returns an HTTP 400 or 422, the Docker console logs often show 
only the HTTP status code (e.g., `POST /api/v1/chart/ 400`) without a full 
Python traceback.

To see the exact field that failed:
1. Open Chrome DevTools (`F12`) and go to the **Network** tab.
2. Attempt to save the visualization chart in Explore.
3. Locate the failed request named `chart/` or `POST /api/v1/chart/`.
4. Click on the request and open the **Response** tab.
5. You will see a structured JSON error detailing which field failed validation 
(for example: `{"message": {"params": ["..."], "viz_type": ["..."]}}`).

### 2. Common Root Causes in Superset 6.1.0 with PostgreSQL

- **Missing Mandatory Visualization Metric/Axis:**
Unlike Table charts which can render with only raw column lists, ECharts and 
visualization plugins require an explicit metric or temporal dimension in the 
chart `form_data`. If an adhoc metric has no label or expression type, the 
schema validation rejects the slice payload.

- **RBAC Chart Permissions:**
Tabular charts in SQL Lab use a lightweight slice save mechanism, whereas 
saving a full visualization chart from Explore requires the user to have the 
FAB permission `can write on Chart` (or `can create on ChartRestApi`). Check in 
**Settings -> List Roles** that your user role has these permissions assigned.

- **PostgreSQL Column Size or JSON Parsing:**
In PostgreSQL backend databases, check the `slices` table schema. Ensure that 
`slices.params` is of type `TEXT` or `JSON/JSONB` and that no custom PostgreSQL 
trigger or character encoding issue is rejecting the JSON payload.

Inspecting the JSON response body in the DevTools Network tab will pinpoint the 
exact key that failed schema validation.


GitHub link: 
https://github.com/apache/superset/discussions/40813#discussioncomment-19164772

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to