Diagnostic reference
GoogleJsonResponseException: drive.files.list Invalid Value
Fix GoogleJsonResponseException Invalid Value on Drive.Files.list in Apps Script by switching Drive v2 fields like title and supportsTeamDrives to v3.
Updated December 6, 2026
Apps Script error
GoogleJsonResponseException: API call to drive.files.list failed with error: Invalid Value
What it means
Apps Script upgraded the Advanced Drive service default from v2 to v3, while built-in DriveApp.searchFiles() still uses v2 syntax. Passing v2 query fields like title, deprecated parameters like supportsTeamDrives, or unescaped single quotes inside q causes Drive.Files.list() to fail with HTTP 400 Invalid Value.
Related error messages
- GoogleJsonResponseException: API call to drive.files.list failed with error: Invalid query
- Exception: Invalid argument: q
Before and after
The code before and after the fix.
function listMatchingReports() {
// Drive API v3 uses "name" instead of v2 "title", and supportsAllDrives instead of supportsTeamDrives.
return Drive.Files.list({
q: "title contains 'Quarterly' and trashed = false",
supportsTeamDrives: true,
});
}function listMatchingReports() {
return Drive.Files.list({
q: "name contains 'Quarterly' and trashed = false",
supportsAllDrives: true,
includeItemsFromAllDrives: true,
fields: 'files(id,name,mimeType)',
});
}How to fix it
- In Advanced Drive v3 (Drive.Files.list), use name instead of title inside q.
- In built-in DriveApp.searchFiles(), keep title instead of name because DriveApp uses Drive v2 query syntax.
- Replace deprecated supportsTeamDrives / includeTeamDriveItems with supportsAllDrives: true and includeItemsFromAllDrives: true.
- Escape literal single quotes inside query strings as \' before interpolating a file name.
Things to check
- Check dependencies.enabledAdvancedServices in appsscript.json to see whether your project pins Drive v2 or v3.
- myFunction catches Drive v2 vs v3 query field and parameter mismatches statically under rule MF95025.
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.