{"record":{"id":"56d619b5eb63cea9","repo":"linshenkx/prompt-optimizer","slug":"google-drive-folder-creation-did-not-return-an-id-56d619","errorCode":null,"errorMessage":"Google Drive folder creation did not return an id: ${name}","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":1195,"sourceCode":"  private async createFolder(parentId: string, name: string): Promise<string> {\n    const response = 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,\n          mimeType: GOOGLE_DRIVE_FOLDER_MIME_TYPE,\n          parents: [parentId],\n        }),\n      },\n      'Google Drive folder creation failed',\n    )\n    const created = await response.json()\n    const id = String(created.id || '')\n    if (!id) throw new Error(`Google Drive folder creation did not return an id: ${name}`)\n    return id\n  }\n\n  private async fetchGoogleDrive(\n    url: string | URL,\n    init: RequestInit,\n    context: string,\n    options?: { downloadRetry?: boolean },\n  ): Promise<Response> {\n    const response = await this.fetchGoogleDriveOnce(url, init, context, false, options)\n    if (!isGoogleAuthStatus(response.status)) {\n      return assertOkResponse(response, context)\n    }\n    await response.body?.cancel().catch(() => undefined)\n    const retryResponse = await this.fetchGoogleDriveOnce(url, init, context, true, options)\n    return assertOkResponse(retryResponse, context)\n  }\n","sourceCodeStart":1177,"sourceCodeEnd":1213,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/ui/src/utils/remote-backup.ts#L1177-L1213","documentation":"Same guard as the root folder creation, but for intermediate folders created while building a nested path (findOrCreateFolderPath). The created folder JSON lacked an id, so the path chain cannot continue.","triggerScenarios":"Creating nested backup directories (e.g. per-date subfolders) when a Drive folder-create response omits id — partial responses, quota errors surfaced as JSON, or API changes.","commonSituations":"Drive quota exceeded returning an error body with 200; flaky network mid-response; mocking in tests.","solutions":["Log response body and retry the folder creation","Check Drive storage quota for the account","Flatten the backup layout to avoid nested folder creation"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (e) { if ((e as Error).message.startsWith('Google Drive folder creation did not return an id')) retry(); else throw e }","preventionTips":["Retry folder creation","Flatten backup paths to reduce folder creation"],"tags":["google-drive","folder-creation","nested-path"],"backgroundTag":"unexpected-api-response","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}