{"record":{"id":"3250947b278815b7","repo":"alyssaxuu/screenity","slug":"file-id-missing-after-upload","errorCode":null,"errorMessage":"File ID missing after upload","messagePattern":"File ID missing after upload","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/pages/Background/drive/handleSaveToDrive.js","lineNumber":340,"sourceCode":"            new Promise((resolve) =>\n              chrome.identity.removeCachedAuthToken({ token: stale }, resolve)\n            ),\n            new Promise((resolve) => setTimeout(resolve, 2000)),\n          ]);\n        }\n      } catch {}\n      const refreshed = await signIn();\n      if (!refreshed) throw new Error(\"Sign-in failed\");\n      await chrome.storage.local.set({ token: refreshed });\n      token = refreshed;\n    } else {\n      token = await getAuthTokenFromStorage();\n      if (!token) throw new Error(\"Sign-in failed\");\n    }\n\n    const folderId = await findOrCreateScreenityFolder(token);\n    const fileId = await uploadResumable(token, videoBlob, fileName, folderId);\n    if (!fileId) throw new Error(\"File ID missing after upload\");\n    return fileId;\n  };\n\n  try {\n    diagEvent(\"drive-upload-start\", {\n      blobSize: videoBlob.size,\n      blobType: videoBlob.type,\n    });\n\n    let fileId;\n    try {\n      fileId = await runUploadOnce(false);\n    } catch (err) {\n      if (isAuthError(err)) {\n        diagEvent(\"drive-auth-retry\", {\n          error: String(err?.message || err).slice(0, 120),\n        });\n        fileId = await runUploadOnce(true);","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/alyssaxuu/screenity/blob/512606387b8d07dda5e63bb428bd063f0a2a3ed0/src/pages/Background/drive/handleSaveToDrive.js#L322-L358","documentation":"After the resumable upload finished, the final Drive response supplied no file id, so the uploaded file cannot be referenced (shared, linked, or cleaned up). A validation guard thrown in runUploadOnce on the upload result.","triggerScenarios":"Thrown at src/pages/Background/drive/handleSaveToDrive.js:340 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log the full upload response to see which fields were actually returned","Recover by listing the Screenity folder for the sanitized filename and using its id","Treat it as a session anomaly and retry the upload once before failing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"512606387b8d07dda5e63bb428bd063f0a2a3ed0","analyzedAt":"2026-09-02T20:59:09.419Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}