linshenkx/prompt-optimizer · error · Error

Google Drive object not found: ${path}

Error message

Google Drive object not found: ${path}

What it means

Google Drive provider's get() resolves a path to a Drive object id via findObjectId; when no object matches the path it throws this not-found error. It indicates the backup file no longer exists at that path in the Drive account/folder.

Source

Thrown at packages/ui/src/utils/remote-backup.ts:856

  }

  async put(
    path: string,
    body: Blob | ArrayBuffer | Uint8Array | string,
    options?: { contentType?: string },
  ): Promise<RemoteObjectEntry> {
    const normalized = normalizeObjectPath(path)
    const blob = bodyToBlob(body, options?.contentType || JSON_MIME_TYPE)
    const existingId = await this.findObjectId(normalized)
    if (existingId) {
      return this.updateFile(existingId, normalized, blob)
    }
    return this.createFile(normalized, blob)
  }

  async get(path: string): Promise<ArrayBuffer> {
    const id = await this.findObjectId(path)
    if (!id) throw new Error(`Google Drive object not found: ${path}`)
    const response = await this.fetchGoogleDrive(
      `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(id)}?alt=media`,
      {},
      `Google Drive download failed: ${normalizeObjectPath(path)}`,
      { downloadRetry: true },
    )
    return response.arrayBuffer()
  }

  async list(prefix: string): Promise<RemoteObjectEntry[]> {
    const normalized = normalizeObjectPath(prefix)
    const folderId = normalized ? await this.findOrCreateFolderPath(normalized) : await this.ensureRootFolderId()
    const basePath = normalized
    return this.listFolderRecursive(folderId, basePath)
  }

  async delete(path: string): Promise<void> {
    const id = await this.findObjectId(path)

View on GitHub (pinned to 3e677b1d9f)

Solutions

  1. Verify the file still exists in the Drive backup folder under the same account
  2. Call list() and match entries by path before get()
  3. Handle not-found as a stale manifest entry and offer re-upload/recreate

Example fix

// before
const buf = await store.get(entry.id)
// after
const entries = await store.list('')
if (!entries.some(e => e.path === entry.id)) throw new Error('stale entry')
const buf = await store.get(entry.id)
Defensive patterns

Strategy: validation

Validate before calling

const entries = await store.list('')
const exists = entries.some(e => e.path === entry.id)

Try / catch

try { await store.get(path) } catch (e) { if ((e as Error).message.includes('object not found')) return null; throw e }

Prevention

When it happens

Trigger: Calling store.get(path) for a backup path that was deleted in Google Drive, moved out of the backup folder, created under a different root folder, or when the OAuth user differs from the one who created the backup.

Common situations: User deleted the file in Drive manually; switching Google accounts; root folder cache pointing to another folder; restoring an old entry whose file was purged.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27). Data as JSON: /api/errors/1a79480a28e49f70. Report an issue: GitHub.