apache/superset · error · Error

Unknown spatial type: ${spatial.type}

Error message

Unknown spatial type: ${spatial.type}

What it means

Thrown by the default branch of getSpatialColumns' switch when spatial.type is set to a value outside 'latlong', 'delimited', and 'geohash'. The message interpolates the offending type, so it doubles as a diagnostic for unknown/new spatial encodings. It indicates schema mismatch rather than a missing field.

Source

Thrown at superset-frontend/plugins/preset-chart-deckgl/src/layers/spatialUtils.ts:99

        throw new Error(
          'Longitude and latitude columns are required for latlong type',
        );
      }
      return [spatial.lonCol, spatial.latCol];
    case 'delimited':
      if (!spatial.lonlatCol) {
        throw new Error(
          'Longitude/latitude column is required for delimited type',
        );
      }
      return [spatial.lonlatCol];
    case 'geohash':
      if (!spatial.geohashCol) {
        throw new Error('Geohash column is required for geohash type');
      }
      return [spatial.geohashCol];
    default:
      throw new Error(`Unknown spatial type: ${spatial.type}`);
  }
}

export function addSpatialNullFilters(
  spatial: SpatialConfiguration,
  filters: QueryObjectFilterClause[],
): QueryObjectFilterClause[] {
  if (!spatial) return filters;

  const spatialColumns = getSpatialColumns(spatial);
  const nullFilters: QueryObjectFilterClause[] = spatialColumns.map(column => ({
    col: column,
    op: 'IS NOT NULL',
    val: null,
  }));

  return [...filters, ...nullFilters];
}

View on GitHub (pinned to f4587218dd)

Solutions

  1. Correct spatial.type to one of the supported values: 'latlong', 'delimited', 'geohash' (exact case).
  2. Re-select the encoding in the Explore spatial control so the canonical value is written.
  3. In forks, extend the switch in spatialUtils.ts to cover the custom type instead of letting it fall through.

Example fix

// before
getSpatialColumns({ type: 'latLong', lonCol: 'lon', latCol: 'lat' }); // throws

// after
getSpatialColumns({ type: 'latlong', lonCol: 'lon', latCol: 'lat' });
Defensive patterns

Strategy: type-guard

Validate before calling

const KNOWN = ['latlong', 'delimited', 'geohash'] as const;
if (!KNOWN.includes(spatial.type)) {
  throw new Error(`Unsupported spatial type: ${spatial.type}`);
}
getSpatialColumns(spatial);

Type guard

const isKnownSpatialType = (s: SpatialConfiguration): boolean =>
  ['latlong', 'delimited', 'geohash'].includes(s.type);

Try / catch

try { getSpatialColumns(spatial); } catch (e) { if (e.message.startsWith('Unknown spatial type')) resetSpatialControl(); else throw e; }

Prevention

When it happens

Trigger: A spatial config whose type is something like 'latlongs', 'GEOHASH' (wrong case), or a custom value added by a plugin/fork — usually from hand-edited params, an older/newer params schema, or a typo when constructing the object in code.

Common situations: Editing chart params JSON directly and mistyping the type; forks that add a new spatial encoding without extending spatialUtils; version skew between saved params and the current plugin code.

Related errors


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