{"record":{"id":"3189c88c2efaa8a5","repo":"linshenkx/prompt-optimizer","slug":"google-drive-resumable-upload-session-did-not-retu","errorCode":null,"errorMessage":"Google Drive resumable upload session did not return a location","messagePattern":"Google Drive resumable upload session did not return a location","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ui/src/utils/remote-backup.ts","lineNumber":947,"sourceCode":"      name,\n      mimeType: blob.type || JSON_MIME_TYPE,\n      parents: [parentId],\n    }\n    const sessionResponse = await this.fetchGoogleDrive(\n      'https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable&fields=id,name,size,modifiedTime,mimeType',\n      {\n        method: 'POST',\n        headers: {\n          'Content-Type': 'application/json; charset=UTF-8',\n          'X-Upload-Content-Type': blob.type || JSON_MIME_TYPE,\n          'X-Upload-Content-Length': String(blob.size),\n        },\n        body: JSON.stringify(metadata),\n      },\n      'Google Drive resumable upload session failed',\n    )\n    const uploadUrl = sessionResponse.headers.get('Location')\n    if (!uploadUrl) throw new Error('Google Drive resumable upload session did not return a location')\n\n    const uploadResponse = await assertOkResponse(await fetch(uploadUrl, {\n      method: 'PUT',\n      headers: {\n        'Content-Type': blob.type || JSON_MIME_TYPE,\n      },\n      body: blob,\n    }), 'Google Drive resumable upload failed')\n    const file = await uploadResponse.json()\n    this.pathIdCache.set(path, String(file.id || ''))\n    return {\n      path,\n      sizeBytes: typeof file.size === 'string' ? Number(file.size) : blob.size,\n      updatedAt: typeof file.modifiedTime === 'string' ? file.modifiedTime : new Date().toISOString(),\n      contentType: typeof file.mimeType === 'string' ? file.mimeType : blob.type,\n    }\n  }\n","sourceCodeStart":929,"sourceCodeEnd":965,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/ui/src/utils/remote-backup.ts#L929-L965","documentation":"The Google Drive provider starts a resumable upload by POSTing metadata and expects a Location header with the upload URL. If Drive's response omits Location, the upload cannot proceed and this error is thrown.","triggerScenarios":"POST to https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable succeeded (2xx) but headers lacked Location; caused by proxies stripping redirect headers, misconfigured fetch shim, or Drive API behavior changes.","commonSituations":"Corporate proxies or service workers rewriting responses; browser extensions; rare API changes. Very low frequency since assertOkResponse already gates non-2xx.","solutions":["Retry the upload once (transient header loss)","Inspect network response headers in devtools to confirm Location is missing; bypass proxy/extension","Fall back to simple (multipart) upload path"],"exampleFix":"// before\nconst uploadUrl = sessionResponse.headers.get('Location')\n// after\nconst uploadUrl = sessionResponse.headers.get('Location')\nif (!uploadUrl) {\n  return this.simpleUpload(normalized, blob) // fallback\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await store.put(path, blob) } catch (e) { if ((e as Error).message.includes('resumable upload session')) return retryWithBackoff(() => store.put(path, blob)); throw e }","preventionTips":["Retry uploads once on transient header loss","Avoid proxies that strip Location headers"],"tags":["google-drive","upload","resumable-upload","missing-header"],"backgroundTag":"upload-session-failed","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}