appsmithorg/appsmith · error · ActionValidationError
showAlert expected STRING for 'message' argument but receive
Error message
showAlert expected STRING for 'message' argument but received ${received} What it means
ActionValidationError thrown by showAlertSaga when payload.message is not a string. showAlert builds a toast, and toasts require a string body, so the saga validates the argument type synchronously before calling showToast. The error message is rendered via the TRIGGER_ACTION_VALIDATION_ERROR template.
Source
Thrown at app/client/src/sagas/ActionExecution/ShowAlertActionSaga.ts:18
import AppsmithConsole from "utils/AppsmithConsole";
import { ActionValidationError } from "sagas/ActionExecution/errorUtils";
import { getType, Types } from "utils/TypeHelpers";
import type { ToastKind } from "@appsmith/ads";
import type { TShowAlertDescription } from "workers/Evaluation/fns/showAlert";
import { call } from "redux-saga/effects";
import showToast from "sagas/ToastSagas";
import { uniqueId } from "lodash";
import type { SourceEntity } from "entities/AppsmithConsole";
export default function* showAlertSaga(
action: TShowAlertDescription,
source?: SourceEntity,
) {
const { payload } = action;
if (typeof payload.message !== "string") {
throw new ActionValidationError(
"SHOW_ALERT",
"message",
Types.STRING,
getType(payload.message),
);
}
// This is the toast that is rendered which is user generated by using `showAlert` platform function. This is forceDisplayed no matter the conditions.
yield call(
showToast,
payload.message,
{
kind: payload.style as ToastKind,
toastId: uniqueId("ToastId"),
},
{ forceDisplay: true },
);
AppsmithConsole.info({View on GitHub (pinned to 8cd9021c24)
Solutions
- Pass a string literal: showAlert('Saved', 'success').
- Drill into the specific string field: showAlert(getApi.data.message).
- Coerce with String(...) or fall back to a default when the bound value may be missing.
Example fix
// before showAlert(getApi.data); // object // after showAlert(getApi.data.message ?? 'No message');
Defensive patterns
Strategy: type-guard
Validate before calling
const msg = typeof payload === 'string' ? payload : String(payload ?? '');
if (!msg) { showAlert('Message is required', 'error'); return; }
showAlert(msg, 'success'); Type guard
function isAlertMessage(v: unknown): v is string {
return typeof v === 'string' && v.length > 0;
} Try / catch
try {
showAlert(message);
} catch (e) {
if (e instanceof ActionValidationError) console.warn(e.message);
} Prevention
- Always drill into a specific string field of a query response before showing it.
- Default to a fallback string when a binding may be undefined.
- Avoid passing raw objects or arrays to showAlert.
When it happens
Trigger: Calling showAlert() with a number, object, array, undefined, or null message; binding message to a query response that resolves to an object (e.g. an entire API response) rather than a string field.
Common situations: Binding {{ getApi.data }} (object) instead of {{ getApi.data.message }}; passing a raw JS object literal; chaining showAlert after an action that returned undefined.
Related errors
- resetWidget expected STRING for 'widgetName' argument but re
- The ${path} path must start with 'https://'.
- error
- Please enter a target origin URL.
- onThemeChange expects a function as parameter
AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12).
Data as JSON: /api/errors/9bc0724d835a622f.
Report an issue: GitHub.