apache/superset · warning

This version does not record a visualization type and datase

Error message

This version does not record a visualization type and dataset, so a new chart cannot be built from it

What it means

Thrown by the version-history feature when trying to create a new chart from a stored chart version whose viz_type, datasource_id, or datasource_type is null. The version table permits nulls (a 'delete' version records nulls throughout), but the chart POST endpoint requires all three; the client fails fast with an actionable message instead of letting the API return an opaque validation error.

Source

Thrown at superset-frontend/src/features/versionHistory/api.ts:128

  });
  return json as { message: string };
}

/** Creates a new chart from a version snapshot; returns the new chart id. */
export async function createChartFromSnapshot(
  snapshot: ChartVersionSnapshot,
  name: string,
): Promise<number> {
  // The chart POST requires all three; the version table allows null for each
  // (a delete version carries nulls throughout). Fail here with something the
  // caller can turn into a toast rather than sending a payload the API will
  // reject with a validation error the user cannot act on.
  if (
    snapshot.viz_type == null ||
    snapshot.datasource_id == null ||
    snapshot.datasource_type == null
  ) {
    throw new Error(
      'This version does not record a visualization type and dataset, so a new chart cannot be built from it',
    );
  }
  const { json } = await SupersetClient.post({
    endpoint: '/api/v1/chart/',
    jsonPayload: {
      slice_name: name,
      viz_type: snapshot.viz_type,
      datasource_id: snapshot.datasource_id,
      datasource_type: snapshot.datasource_type,
      ...(snapshot.params != null && { params: snapshot.params }),
      ...(snapshot.query_context != null && {
        query_context: snapshot.query_context,
      }),
      ...(snapshot.description != null && {
        description: snapshot.description,
      }),
      ...(snapshot.cache_timeout != null && {

View on GitHub (pinned to f4587218dd)

Solutions

  1. Pick a non-delete version (one that records a visualization type and dataset) from the history list.
  2. If the chart was deleted, restore the chart first so real versions with metadata exist, then create from a version.
  3. As a developer, filter version entries with null viz_type/datasource out of the 'create chart' UI before the action is offered.

Example fix

// before
const id = await createChartFromVersion(snapshot, name);

// after
if (snapshot.viz_type == null || snapshot.datasource_id == null || snapshot.datasource_type == null) {
  disableCreateFromVersion(snapshot.id);
} else {
  const id = await createChartFromVersion(snapshot, name);
}
Defensive patterns

Strategy: validation

Validate before calling

const canCreateFromVersion = (s: ChartVersionSnapshot): boolean =>
  s.viz_type != null && s.datasource_id != null && s.datasource_type != null;
if (!canCreateFromVersion(snapshot)) {
  disableCreateAction(snapshot);
}

Type guard

const isCreatableSnapshot = (
  s: ChartVersionSnapshot,
): s is ChartVersionSnapshot & { viz_type: string; datasource_id: number; datasource_type: string } =>
  s.viz_type != null && s.datasource_id != null && s.datasource_type != null;

Try / catch

try { await createChartFromVersion(snapshot, name); } catch (e) { if (e.message.includes('does not record a visualization type')) showToast('Pick a non-delete version'); else throw e; }

Prevention

When it happens

Trigger: Selecting a version in the version-history panel and choosing 'create chart from this version' where the version is a deletion snapshot, or an older version row written before viz/datasource tracking was added.

Common situations: Users clicking a 'deleted' entry in version history; restoring from versions created before the snapshot fields existed (upgrade/migration); versions whose chart was deleted and only the tombstone remains.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/350570840597b1e7. Report an issue: GitHub.