different-ai/openwork · error
Workspace export is only supported for local workspaces
Error message
Workspace export is only supported for local workspaces
What it means
exportWorkspaceConfig packages a workspace's local config (opencode.json and .opencode/) into a ZIP. It only supports local workspaces: if the workspace object has no path, or its workspaceType is 'remote', exporting is refused because there is no local filesystem tree to archive.
Source
Thrown at apps/desktop/electron/workspace-archive.mjs:258
return !normalized.split("/").some((part) => part === ".." || part === "");
}
function defaultOpenworkConfig(targetDir, preset = "starter") {
return {
version: 1,
workspace: {
name: path.basename(targetDir) || "Workspace",
createdAt: nowMs(),
preset,
},
authorizedRoots: [targetDir],
reload: null,
};
}
export async function exportWorkspaceConfig({ workspace, outputPath }) {
if (!workspace?.path || workspace.workspaceType === "remote") {
throw new Error("Workspace export is only supported for local workspaces");
}
const workspaceRoot = workspace.path;
if (!(await pathExists(workspaceRoot))) {
throw new Error(`Workspace path not found: ${workspaceRoot}`);
}
const { entries, excluded } = await collectWorkspaceEntries(workspaceRoot);
if (entries.length === 0) throw new Error("No workspace config files found to export");
const files = [];
const included = [];
for (const entry of entries) {
files.push({ name: entry.rel, data: await readFile(entry.absolute) });
included.push(entry.rel);
}
files.push({
name: "manifest.json",
data: `${JSON.stringify({View on GitHub (pinned to 2b7df46e8a)
Solutions
- Call exportWorkspaceConfig only for workspaces whose workspaceType is 'local' and which have a valid path
- For remote workspaces, clone/checkout the content locally first, then export that directory
- Ensure the workspace object is fully loaded (path populated) before exporting
Example fix
// before
await exportWorkspaceConfig({ workspace: { id: 'remote-1', workspaceType: 'remote' } })
// after
if (ws.workspaceType !== 'remote' && ws.path) {
await exportWorkspaceConfig({ workspace: ws })
} Defensive patterns
Strategy: type-guard
Validate before calling
function canExport(ws) {
return Boolean(ws?.path) && ws.workspaceType !== 'remote';
} Type guard
function isExportableWorkspace(ws) {
return typeof ws?.path === 'string' && ws.path.length > 0 && ws.workspaceType !== 'remote';
} Try / catch
try {
await exportWorkspaceConfig({ workspace });
} catch (err) {
if (err.message === 'Workspace export is only supported for local workspaces') {
// surface 'choose a local workspace' to the user
} else throw err;
} Prevention
- Check workspaceType in the UI before offering Export
- Ensure workspace objects are fully loaded (path populated)
- Handle remote workspaces with a separate flow
When it happens
Trigger: Calling exportWorkspaceConfig with workspace.workspaceType === 'remote', or with a workspace object missing the path property (null/undefined path).
Common situations: Selecting a cloud/remote workspace in the UI and attempting an export; passing a partially-constructed workspace object without path; version changes where workspaceType was added and older callers omit it with no path.
Related errors
- Select a local workspace before starting the local server/en
- app.error_connect_first
- invalid_path
- No workspace config files found to export
- Agent context diagnostics timeout must be between 1 ms and 3
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/c103b34e7b77a4d7.
Report an issue: GitHub.