{"record":{"id":"7b529f551816ad06","repo":"linshenkx/prompt-optimizer","slug":"google-drive-folder-creation-did-not-return-an-id","errorCode":null,"errorMessage":"Google Drive folder creation did not return an id","messagePattern":"Google Drive folder creation did not return an id","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ui/src/utils/remote-backup.ts","lineNumber":1094,"sourceCode":"    }\n\n    const createResponse = await this.fetchGoogleDrive(\n      'https://www.googleapis.com/drive/v3/files?fields=id,name',\n      {\n        method: 'POST',\n        headers: {\n          'Content-Type': 'application/json',\n        },\n        body: JSON.stringify({\n          name: folderName,\n          mimeType: GOOGLE_DRIVE_FOLDER_MIME_TYPE,\n        }),\n      },\n      'Google Drive folder creation failed',\n    )\n    const created = await createResponse.json()\n    this.rootFolderId = String(created.id || '')\n    if (!this.rootFolderId) throw new Error('Google Drive folder creation did not return an id')\n    this.pathIdCache.set('', this.rootFolderId)\n    return this.rootFolderId\n  }\n\n  private async findOrCreateFolderPath(path: string): Promise<string> {\n    const normalized = normalizeObjectPath(path)\n    if (!normalized) return this.ensureRootFolderId()\n    const cached = this.pathIdCache.get(normalized)\n    if (cached) return cached\n\n    let currentId = await this.ensureRootFolderId()\n    let currentPath = ''\n    for (const segment of normalized.split('/').filter(Boolean)) {\n      currentPath = joinRemotePath(currentPath, segment)\n      const cachedSegment = this.pathIdCache.get(currentPath)\n      if (cachedSegment) {\n        currentId = cachedSegment\n        continue","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/ui/src/utils/remote-backup.ts#L1076-L1112","documentation":"After POSTing to create the root backup folder in Google Drive, the provider reads created.id from the JSON response. If the response has no id field, it throws because subsequent path resolution depends on the folder id.","triggerScenarios":"Drive folder creation endpoint returns 2xx JSON without an id — malformed proxy response, API version change, or an error body that still parsed as JSON.","commonSituations":"Rare; usually a proxy/mocking layer returning unexpected JSON during tests or a Drive API regression.","solutions":["Log the full createResponse body to see what Drive actually returned","Retry folder creation; transient API glitches can return incomplete bodies","Check for corporate proxies/mocks altering Drive API responses"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await store.put(...) } catch (e) { if ((e as Error).message.includes('folder creation')) await sleep(1000).then(() => store.put(...)); throw e }","preventionTips":["Treat missing-id folder responses as transient","Log response bodies for Drive calls in dev"],"tags":["google-drive","folder-creation","missing-id"],"backgroundTag":"unexpected-api-response","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}