{"record":{"id":"47e683fd650c89ff","repo":"apache/superset","slug":"longitude-and-latitude-columns-are-required","errorCode":null,"errorMessage":"Longitude and latitude columns are required","messagePattern":"Longitude and latitude columns are required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"superset-frontend/plugins/plugin-chart-point-cluster-map/src/buildQuery.ts","lineNumber":47,"sourceCode":"  all_columns_x?: string;\n  all_columns_y?: string;\n  map_label?: string[];\n  point_radius?: string;\n  clustering_radius?: string;\n  pandas_aggfunc?: string;\n  global_opacity?: number;\n  maplibre_style?: string;\n  mapbox_style?: string;\n  map_color?: string;\n  render_while_dragging?: boolean;\n  point_radius_unit?: string;\n}\n\nexport default function buildQuery(formData: MapLibreFormData) {\n  const { all_columns_x, all_columns_y, map_label, point_radius } = formData;\n\n  if (!all_columns_x || !all_columns_y) {\n    throw new Error('Longitude and latitude columns are required');\n  }\n\n  return buildQueryContext(formData, (baseQueryObject: QueryObject) => {\n    const columns: QueryFormColumn[] = [\n      ...ensureIsArray(baseQueryObject.columns || []),\n      all_columns_x,\n      all_columns_y,\n    ];\n\n    // Add label column if specified and not 'count'\n    const hasCustomMetric =\n      map_label && map_label.length > 0 && map_label[0] !== 'count';\n    if (hasCustomMetric) {\n      columns.push(map_label[0]);\n    }\n\n    // Add point radius column if not \"Auto\"\n    if (point_radius && point_radius !== 'Auto') {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset-frontend/plugins/plugin-chart-point-cluster-map/src/buildQuery.ts#L29-L65","documentation":"Thrown by the point-cluster-map plugin's buildQuery when the form data is missing the longitude (all_columns_x) or latitude (all_columns_y) column. The map has nothing to plot without coordinates, so query construction aborts before a request is sent. This is a form-state validation error, nearly always caused by a chart whose controls were never fully configured or whose columns disappeared.","triggerScenarios":"Rendering/running a Point Cluster Map chart where all_columns_x or all_columns_y is empty — e.g. a newly added chart sliced before columns were chosen, a saved chart whose dataset dropped/renamed the bound column, or a programmatic query_context payload built without those keys.","commonSituations":"Dataset schema drift (column renamed/deleted) breaking saved dashboards; importing/changing the dataset of an existing chart; dashboards loaded from JSON export where the form params omit the coordinate columns.","solutions":["Open the chart in Explore and set both the longitude (X) and latitude (Y) columns in the control panel, then save.","If the dataset changed, rebind the chart to columns that exist (or restore/rename the removed column in the dataset).","When building query contexts programmatically, include all_columns_x/all_columns_y in formData before invoking buildQuery."],"exampleFix":"// before\nconst query = buildQuery({ ...formData }); // all_columns_x undefined -> throws\n\n// after\nif (!formData.all_columns_x || !formData.all_columns_y) {\n  throw new Error('Configure longitude/latitude columns before querying');\n}\nconst query = buildQuery(formData);","handlingStrategy":"validation","validationCode":"if (!formData.all_columns_x || !formData.all_columns_y) {\n  throw new Error('Point cluster map requires longitude and latitude columns');\n}\nconst query = buildQuery(formData);","typeGuard":"const hasCoordinateColumns = (fd: MapLibreFormData): boolean =>\n  Boolean(fd.all_columns_x) && Boolean(fd.all_columns_y);","tryCatchPattern":"try { buildQuery(formData); } catch (e) { if (e.message === 'Longitude and latitude columns are required') showConfigToast('Set X/Y columns'); else throw e; }","preventionTips":["Treat coordinate columns as required in chart-creation flows","Validate formData keys before building query contexts programmatically"],"tags":["map","buildquery","form-data","validation"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}