benweet/stackedit · error · Error
Folder ${folderId} is part of another workspace.
Error message
Folder ${folderId} is part of another workspace. What it means
Google Drive folders can be claimed by at most one workspace; the provider stamps the folder's appProperties.folderId with the workspace's folder ID. If the fetched folder already has a folderId property that differs from the folderId being initialized, initWorkspace throws this error at src/services/providers/googleDriveWorkspaceProvider.js:136. It is a deliberate conflict guard preventing two workspaces from sharing one Drive folder.
Source
Thrown at src/services/providers/googleDriveWorkspaceProvider.js:136
await initFolder(token, {
...folder,
appProperties: {},
});
folderId = folder.id;
}
// Init workspace
if (!getWorkspace(folderId)) {
let folder;
try {
folder = await googleHelper.getFile(token, folderId);
} catch (err) {
throw new Error(`Folder ${folderId} is not accessible. Make sure you have the right permissions.`);
}
folder.appProperties = folder.appProperties || {};
const folderIdProperty = folder.appProperties.folderId;
if (folderIdProperty && folderIdProperty !== folderId) {
throw new Error(`Folder ${folderId} is part of another workspace.`);
}
await initFolder(token, folder);
}
badgeSvc.addBadge('addGoogleDriveWorkspace');
return getWorkspace(folderId);
},
async performAction() {
const state = googleHelper.driveState || {};
const token = this.getToken();
switch (token && state.action) {
case 'create': {
const driveFolder = googleHelper.driveActionFolder;
let syncData = store.getters['data/syncDataById'][driveFolder.id];
if (!syncData && driveFolder.appProperties.id) {
// Create folder if not already synced
store.commit('folder/setItem', {
id: driveFolder.appProperties.id,View on GitHub (pinned to 6dce2a5e36)
Solutions
- Pick a fresh, empty Drive folder for the new workspace.
- Clear the appProperties.folderId property on the existing folder (via Drive API or the original workspace) before reusing it.
- Open the workspace that already owns this folder instead of creating a new one.
- Verify you did not paste the wrong folder ID when configuring the workspace.
Example fix
// before
throw new Error(`Folder ${folderId} is part of another workspace.`);
// after
const reuse = confirm(`Folder ${folderId} belongs to another workspace. Reinitialize it for this workspace?`);
if (!reuse) {
throw new Error(`Folder ${folderId} is part of another workspace.`);
}
folder.appProperties.folderId = folderId; Defensive patterns
Strategy: validation
Validate before calling
async function folderBelongsToWorkspace(token, folderId) {
const meta = await fetch(`https://www.googleapis.com/drive/v3/files/${encodeURIComponent(folderId)}?fields=appProperties`,
{ headers: { Authorization: `Bearer ${token.accessToken}` } }).then(r => r.json());
const claimed = meta.appProperties && meta.appProperties.folderId;
return !claimed || claimed === folderId ? null : claimed;
} Type guard
function isClaimedByOtherWorkspace(folder, folderId) {
const claimed = folder && folder.appProperties && folder.appProperties.folderId;
return typeof claimed === 'string' && claimed !== '' && claimed !== folderId;
} Try / catch
try {
await provider.initWorkspace(...);
} catch (err) {
if (/part of another workspace/.test(err.message)) {
promptUserToChooseAFreshFolderOrOpenExistingWorkspace(err);
}
} Prevention
- Always create workspaces in fresh, empty Drive folders.
- Never copy/duplicate an existing workspace folder — its appProperties travel with it.
- Check folder appProperties before pointing a new workspace at a folder.
- Open the existing workspace instead of re-initializing its folder.
When it happens
Trigger: Calling initWorkspace on a Drive folder whose appProperties.folderId exists and does not equal the requested folderId — i.e. the folder was already initialized as (or renamed/reused from) another workspace.
Common situations: Reusing a folder that previously belonged to a deleted workspace; pointing a new workspace at an old workspace's folder; syncing/copying a workspace folder so its appProperties carried over.
Related errors
AI-assisted analysis of benweet/stackedit@6dce2a5e36 (2026-09-01).
Data as JSON: /api/errors/cf738cdfd3c0a667.
Report an issue: GitHub.