apache/superset · error

Group by param is required

Error message

Group by param is required

What it means

TTestTable (Paired t-test chart) requires at least one Group By column to compute groups; the component throws when the groups array from form_data is missing or empty. Without a group dimension there is nothing to stratify the t-test by, so rendering aborts.

Source

Thrown at superset-frontend/plugins/plugin-chart-paired-t-test/src/TTestTable.tsx:271

      if (row === control) {
        return 'control';
      }

      // p-values significant below set threshold
      return Number(pValues[row]) <= alpha;
    },
    [control, pValues, alpha],
  );

  const handleRowClick = useCallback(
    (rowIndex: number) => {
      computeTTest(rowIndex);
    },
    [computeTTest],
  );

  if (!Array.isArray(groups) || groups.length === 0) {
    throw new Error('Group by param is required');
  }

  // Map a status keyword to its theme color; the control/significant/lift
  // states reuse the semantic antd tokens.
  const statusColor = (status: string): string | undefined => {
    switch (status) {
      case 'control':
        return theme.colorPrimary;
      case 'true':
        return theme.colorSuccess;
      case 'false':
        return theme.colorError;
      case 'invalid':
        return theme.colorWarning;
      default:
        return undefined;
    }
  };

View on GitHub (pinned to f4587218dd)

Solutions

  1. Open the chart in Explore and set at least one Group By column, then save.
  2. Fix imported chart JSON so formData.groupby is a non-empty array of valid columns.
  3. When generating permalinks/URLs programmatically, do not send groupby: [].
  4. Guard the chart container with an error boundary so one bad chart does not break the whole dashboard.

Example fix

// before
"groupby": [],

// after
"groupby": ["group"],
Defensive patterns

Strategy: validation

Validate before calling

import { ensureIsArray } from '@superset-ui/core';

const hasGroupBy = Array.isArray(groups) && groups.length > 0;
if (!hasGroupBy) {
  // render configuration hint instead of mounting TTestTable
}

Type guard

function hasGroupbyColumns(formData: unknown): formData is { groupby: string[] } {
  return (
    !!formData &&
    typeof formData === 'object' &&
    Array.isArray((formData as { groupby?: unknown }).groupby) &&
    ((formData as { groupby: unknown[] }).groupby.length as number) > 0
  );
}

Try / catch

<ErrorBoundary fallbackRender={() => <Alert type="error" message={t('Paired t-test requires a Group By column')} />}>
  <TTestTable ... />
</ErrorBoundary>

Prevention

When it happens

Trigger: Opening a Paired t-test chart whose form_data has no groupby; a dashboard import where the groupby array was dropped; data-mask/URL params overwriting groupby with an empty list.

Common situations: Chart saved before Group By was configured; explore URL params (e.g. preselect_filters or permalink) clearing groupby; migrating charts between Superset versions with schema changes to groupby.

Related errors


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