apache/superset · error
Please call with an object. Example: `stringify myObj`
Error message
Please call with an object. Example: `stringify myObj`
What it means
A Handlebars helper registered by the Handlebars (markdown-templated) chart plugin. The stringify helper throws when it is invoked in a template without a usable argument (the second positional parameter is undefined), telling the template author to call it as {{stringify myObj}} to pretty-print an object.
Source
Thrown at superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx:90
htmlSanitization={htmlSanitization}
htmlSchemaOverrides={htmlSchemaOverrides}
/>
);
}
return <p>{t('Loading...')}</p>;
};
// usage: {{ dateFormat my_date format="MMMM YYYY" }}
Handlebars.registerHelper('dateFormat', function (context, block) {
const f = block.hash.format || 'YYYY-MM-DD';
return dayjs(context).format(f);
});
// usage: {{ }}
Handlebars.registerHelper('stringify', (obj: any, obj2: any) => {
// calling without an argument
if (obj2 === undefined)
throw new Error('Please call with an object. Example: `stringify myObj`');
return isPlainObject(obj) ? JSON.stringify(obj) : String(obj);
});
Handlebars.registerHelper(
'formatNumber',
function (number: any, locale = 'en-US') {
if (typeof number !== 'number') {
return number;
}
return number.toLocaleString(locale);
},
);
// usage: {{parseJson jsonString}}
Handlebars.registerHelper('parseJson', (jsonString: string) => {
try {
return JSON.parse(jsonString);
} catch (error) {View on GitHub (pinned to f4587218dd)
Solutions
- Fix the template: call {{stringify myObj}} with an actual object field present in the query result.
- Guard in the template: {{#if myObj}}{{stringify myObj}}{{/if}}.
- Verify the column names in the template match the dataset columns returned by the chart query.
- Render the chart with sample rows in Explore to confirm the field exists before publishing.
Example fix
{{! before }}
{{stringify}}
{{! after }}
{{#if row.payload}}
{{stringify row.payload}}
{{/if}} Defensive patterns
Strategy: type-guard
Validate before calling
{{! inside the Handlebars template }}
{{#if myObj}}
{{stringify myObj}}
{{/if}} Type guard
{{! custom guard helper or inline check }}
{{#if (isPlainObject myObj)}}
{{stringify myObj}}
{{else}}
<span class="muted">n/a</span>
{{/if}} Try / catch
try {
const html = Handlebars.compile(templateString)(data);
} catch (e) {
if (e instanceof Error && e.message.includes('stringify')) {
setTemplateError(t('Template calls stringify without an object; check field names'));
return;
}
throw e;
} Prevention
- Test templates against representative rows (including missing fields) before publishing the chart.
- Prefer {{#if}} guards around helpers that require arguments.
- Keep a lint step for templates that flags helpers invoked with zero arguments.
When it happens
Trigger: A Handlebars template used by the chart contains {{stringify}} with no argument, or passes undefined (e.g. {{stringify missingField}} where the field is absent from the row).
Common situations: Templates authored against sample data where the field existed, then pointed at data missing that column; typos in field names inside the template; templates copied from just-handlebars-factories examples.
Related errors
- Invalid JSON string: ${String(error)}
- When using 'Group By' you are limited to use a single metric
- Group by param is required
- Unknown deck.gl layer type: ${vizType}
- Error in jinja expression in fetch values predicate: %(msg)s
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/237948eceb59952b.
Report an issue: GitHub.