{"record":{"id":"c503bf3ddb56fceb","repo":"benweet/stackedit","slug":"folder-folderid-is-not-accessible-make-sure-yo","errorCode":null,"errorMessage":"Folder ${folderId} is not accessible. Make sure you have the right permissions.","messagePattern":"Folder (.+?) is not accessible\\. Make sure you have the right permissions\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/services/providers/googleDriveWorkspaceProvider.js","lineNumber":131,"sourceCode":"        token,\n        name: 'StackEdit workspace',\n        parents: [],\n        mediaType: googleHelper.folderMimeType,\n      });\n      await initFolder(token, {\n        ...folder,\n        appProperties: {},\n      });\n      folderId = folder.id;\n    }\n\n    // Init workspace\n    if (!getWorkspace(folderId)) {\n      let folder;\n      try {\n        folder = await googleHelper.getFile(token, folderId);\n      } catch (err) {\n        throw new Error(`Folder ${folderId} is not accessible. Make sure you have the right permissions.`);\n      }\n      folder.appProperties = folder.appProperties || {};\n      const folderIdProperty = folder.appProperties.folderId;\n      if (folderIdProperty && folderIdProperty !== folderId) {\n        throw new Error(`Folder ${folderId} is part of another workspace.`);\n      }\n      await initFolder(token, folder);\n    }\n\n    badgeSvc.addBadge('addGoogleDriveWorkspace');\n    return getWorkspace(folderId);\n  },\n  async performAction() {\n    const state = googleHelper.driveState || {};\n    const token = this.getToken();\n    switch (token && state.action) {\n      case 'create': {\n        const driveFolder = googleHelper.driveActionFolder;","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/benweet/stackedit/blob/6dce2a5e36b755a0c244522b48a06c91a2df0f59/src/services/providers/googleDriveWorkspaceProvider.js#L113-L149","documentation":"When initializing a Google Drive workspace, the provider fetches the Drive folder metadata with googleHelper.getFile(token, folderId). Any failure of that call is replaced by this error at src/services/providers/googleDriveWorkspaceProvider.js:131, meaning the folder could not be read with the current token. It does not distinguish 404 (wrong ID) from 403 (no permission) or network failure.","triggerScenarios":"googleHelper.getFile(token, folderId) throws inside initWorkspace: folder deleted, wrong folder ID, token lacking access to that folder, Drive API error, or offline request failure.","commonSituations":"Pasting a folder ID the signed-in Google account cannot see; folder moved to trash; OAuth token granted for a different account; Drive API quota or transient network error during setup.","solutions":["Confirm the folder ID and that the authenticated Google account has at least reader access to it.","Reconnect the Google account so the token matches an account with access to the folder.","Restore the folder from trash or create a new workspace folder.","Retry if the failure was transient (network/Drive API outage); check the Drive API response in the network tab."],"exampleFix":"// before\n} catch (err) {\n  throw new Error(`Folder ${folderId} is not accessible. Make sure you have the right permissions.`);\n}\n// after\n} catch (err) {\n  throw new Error(`Folder ${folderId} is not accessible. Make sure you have the right permissions. (${err && err.message})`);\n}","handlingStrategy":"validation","validationCode":"async function canAccessDriveFolder(token, folderId) {\n  try {\n    const res = await fetch(`https://www.googleapis.com/drive/v3/files/${encodeURIComponent(folderId)}?fields=id`,\n      { headers: { Authorization: `Bearer ${token.accessToken}` } });\n    return res.ok;\n  } catch (e) {\n    return false;\n  }\n}","typeGuard":"function isDriveFile(f) {\n  return f && typeof f.id === 'string' && typeof f.name === 'string' && !f.trashed;\n}","tryCatchPattern":"try {\n  await provider.initWorkspace(...);\n} catch (err) {\n  if (/not accessible/.test(err.message)) {\n    guideUserToReconnectGoogleAccountOrFixFolderId(err);\n  }\n}","preventionTips":["Confirm the folder ID and account access before initializing a workspace.","Keep the folder out of trash; verify in Drive UI first.","Re-authenticate with the Google account that owns the folder.","Handle transient Drive API failures with a bounded retry."],"tags":["google-drive","permissions","workspace"],"backgroundTag":"resource-access-denied","analyzedSha":"6dce2a5e36b755a0c244522b48a06c91a2df0f59","analyzedAt":"2026-09-01T00:49:23.866Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}