appsmithorg/appsmith · error · ActionValidationError

resetWidget expected STRING for 'widgetName' argument but re

Error message

resetWidget expected STRING for 'widgetName' argument but received ${received}

What it means

ActionValidationError thrown by resetWidgetActionSaga when the widgetName argument is not a string. The error message is built from the TRIGGER_ACTION_VALIDATION_ERROR template and surfaces the expected vs received type, so the user can see exactly what resetWidget rejected. This is a synchronous argument-type check before the saga ever touches the widget tree.

Source

Thrown at app/client/src/sagas/ActionExecution/ResetWidgetActionSaga.ts:24

  ActionValidationError,
  TriggerFailureError,
} from "sagas/ActionExecution/errorUtils";
import { getType, Types } from "utils/TypeHelpers";
import type { FlattenedWidgetProps } from "WidgetProvider/types";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import type { TResetWidgetDescription } from "workers/Evaluation/fns/resetWidget";
import AppsmithConsole from "utils/AppsmithConsole";
import type { SourceEntity } from "entities/AppsmithConsole";

export default function* resetWidgetActionSaga(
  action: TResetWidgetDescription,
  source?: SourceEntity,
) {
  const { payload } = action;
  const { metaUpdates, resetChildren, widgetName } = payload;

  if (getType(widgetName) !== Types.STRING) {
    throw new ActionValidationError(
      "RESET_WIDGET_META_RECURSIVE_BY_NAME",
      "widgetName",
      Types.STRING,
      getType(widgetName),
    );
  }

  const widget: FlattenedWidgetProps | undefined = yield select(
    getWidgetByName,
    widgetName,
  );

  if (!widget) {
    throw new TriggerFailureError(`Widget ${payload.widgetName} not found`);
  }

  yield put(resetWidgetMetaUpdates(metaUpdates));

View on GitHub (pinned to 8cd9021c24)

Solutions

  1. Pass the literal widget name string, e.g. resetWidget('Input1').
  2. If the value comes from a binding, coerce or guard it: resetWidget(String(name)).
  3. Verify in the JS object that the resolved value is a string before calling resetWidget.

Example fix

// before
resetWidget(Table1.selectedRow); // object
// after
resetWidget('Input1');           // string literal
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof widgetName !== 'string' || !widgetName.trim()) {
  showAlert('resetWidget needs a widget name string', 'error');
  return;
}
resetWidget(widgetName);

Type guard

function isWidgetName(v: unknown): v is string {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

try {
  resetWidget(name);
} catch (e) {
  if (e instanceof ActionValidationError) showAlert(e.message, 'error');
}

Prevention

When it happens

Trigger: Calling resetWidget() with a number, object, array, undefined, or null as widgetName; binding widgetName to a query result or store value that resolves to a non-string; passing a widget reference object instead of its name.

Common situations: Binding {{ Table1.selectedRow }} (object) into widgetName; passing an undefined variable because the source row was cleared; copy-paste left a placeholder like {{ }} in the field.

Related errors


AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12). Data as JSON: /api/errors/f2b47e317b33c2c0. Report an issue: GitHub.