Skip to content

Diagnostic reference

GoogleJsonResponseException: drive.files.get File not found

Fix GoogleJsonResponseException: API call to drive.files.get failed with error: File not found in Apps Script by enabling supportsAllDrives and checking access.

Updated December 6, 2026

Apps Script error

GoogleJsonResponseException: API call to drive.files.get failed with error: File not found: 1AbCdEf...

What it means

Google Drive API v3 ignores files inside Shared Drives unless you pass supportsAllDrives: true (and includeItemsFromAllDrives: true on Drive.Files.list). Drive also returns 404 File not found instead of 403 when the executing account has no permission to see the file, when the ID is malformed, or when the OAuth scope is limited to drive.file.

Related error messages

  • GoogleJsonResponseException: API call to drive.files.update failed with error: File not found: ...
  • GoogleJsonResponseException: API call to drive.files.copy failed with error: File not found: ...
  • GoogleJsonResponseException: API call to drive.permissions.create failed with error: File not found: ...

Before and after

The code before and after the fix.

Problem 2 changed lines
function readSharedDriveFile(fileId) {
  // Without supportsAllDrives: true, Drive API v3 returns 404 for files in Shared Drives.
  const meta = Drive.Files.get(fileId, { fields: 'id,name,mimeType' });
  Logger.log(meta.name);
}
Fixed 4 changed lines
function readSharedDriveFile(fileId) {
  const meta = Drive.Files.get(fileId, {
    fields: 'id,name,mimeType',
    supportsAllDrives: true,
  });
  Logger.log(meta.name);
}

How to fix it

  • Add supportsAllDrives: true to Drive.Files.get(), update(), copy(), remove(), and Drive.Permissions.create() when files can live in a Shared Drive.
  • For Drive.Files.list(), pass both supportsAllDrives: true and includeItemsFromAllDrives: true.
  • Confirm the executing account (Session.getEffectiveUser()) has at least Viewer access to the target file or Shared Drive.
  • Check that you passed the file ID between /d/ and /edit, not the full URL or a trailing query string.

Things to check

  • If appsscript.json limits OAuth scopes to https://www.googleapis.com/auth/drive.file, Drive returns File not found for files your app did not create or open via Google Picker.
  • myFunction flags Drive v3 calls missing Shared Drive flags statically under rule MF95021.

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.