Diagnostic reference
Exception: Argument too large: value
Fix Exception: Argument too large: value or key in Apps Script PropertiesService (9 KB) and CacheService (100 KB / 250-char key) by chunking or using Drive.
Updated December 6, 2026
Apps Script error
Exception: Argument too large: value
What it means
PropertiesService limits each value to 9 KB and each store to 500 KB total. CacheService limits each value to 100 KB and each key name to 250 characters. Passing a serialized sheet dump, API response, or long URL key past those caps throws Argument too large.
Related error messages
- Exception: Argument too large: key
- Exception: Limit Exceeded: Property storage size.
Before and after
The code before and after the fix.
function cacheBigPayload(rows) {
// PropertiesService caps each property value at 9 KB (9,216 bytes).
const props = PropertiesService.getScriptProperties();
props.setProperty('ALL_ROWS', JSON.stringify(rows));
}function cacheBigPayload(rows) {
const json = JSON.stringify(rows);
if (Utilities.newBlob(json).getBytes().length <= 100 * 1024) {
CacheService.getScriptCache().put('ALL_ROWS', json, 1800);
return;
}
// Store larger payloads in a Drive file and keep only the file ID in PropertiesService.
const file = DriveApp.createFile('all-rows-cache.json', json, 'application/json');
PropertiesService.getScriptProperties().setProperty('ALL_ROWS_FILE_ID', file.getId());
}How to fix it
- Measure UTF-8 byte length with Utilities.newBlob(text).getBytes().length before calling setProperty() or cache.put().
- For temporary payloads between 9 KB and 100 KB, use CacheService instead of PropertiesService.
- For durable data larger than 9 KB (or temporary data over 100 KB), save JSON to a Drive file or hidden sheet tab and store only the file ID in PropertiesService.
- If the error names Argument too large: key, hash long cache keys (such as URLs) with Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, rawKey).
Things to check
- CacheService entries can be evicted before their requested expiration (up to 6 hours), so always recompute on a cache miss.
- myFunction catches static PropertiesService and CacheService size violations under rule MF95012.
In the Apps Script editor
Catch errors like this before clicking Run.
myFunction (published as Error Checker for Google Apps Script on the Chrome Web Store) checks your code while you edit at script.google.com. Diagnostics, autocomplete, and rule-based quick fixes are free without an account, run in your browser, and request no Google Drive, Gmail, or Apps Script project OAuth scopes. Writing Apps Script with an AI coding agent? Connect the Apps Script MCP server to run the same static checks before pasting code.