Error guides

setValue(undefined) and JSON.stringify(enum) changed on V8

Two silent behaviour changes from Google's migration guide. Nothing throws — data just looks different.

undefined arguments

In Rhino, passing undefined to an Apps Script method passed the string "undefined". In V8 it's treated like null.

range.setValue(undefined);
// Rhino: the cell shows the text "undefined"
// V8:    the cell is cleared

This usually surfaces as a bug fix (no more "undefined" in reports) — but if anything downstream searched for the text "undefined", or a cell is now blank when a formula expects a value, write an explicit value:

range.setValue(value === undefined ? '' : value);

Enums in JSON.stringify

JSON.stringify(Charts.ChartType.BUBBLE);
// Rhino: "{}"
// V8:    "\"BUBBLE\""

If you cached or compared stringified enums, compare enum values directly (type === Charts.ChartType.BUBBLE) or use String(enumValue).

How V8Shift handles it

setValue(undefined)-style calls and JSON.stringify of Apps Script enums are flagged as warnings with file and line.

Have a whole project to migrate? Paste your .gs or upload a zip for a free V8 compatibility report — every occurrence of this pattern with file and line, plus an auto-rewritten project.
Related errors