different-ai/openwork · error

No workspace config files found to export

Error message

No workspace config files found to export

What it means

After collecting eligible files, exportWorkspaceConfig requires at least one of opencode.json or files under .opencode/ (non-secret). If the set is empty, there is nothing meaningful to package, so it throws instead of producing an empty archive.

Source

Thrown at apps/desktop/electron/workspace-archive.mjs:266

      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({
      version: 1,
      createdAtMs: nowMs(),
      workspace: { id: workspace.id, name: workspace.name, path: workspace.path },
      included,
      excluded,
    }, null, 2)}\n`,
  });
  await writeZip(outputPath, files);

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Create opencode.json or add files under .opencode/ in the workspace, then re-export
  2. Point the export at the correct workspace root that actually contains config
  3. If needed config exists but is secret-named (.env, *.pem), rename/restructure it so it is not excluded

Example fix

// before
exportWorkspaceConfig({ workspace: { path: '/tmp/empty-ws' } })  // no config files
// after
# add config first
echo '{}' > /tmp/empty-ws/opencode.json
exportWorkspaceConfig({ workspace: { path: '/tmp/empty-ws' } })
Defensive patterns

Strategy: validation

Validate before calling

import { readdir, stat } from 'node:fs/promises';
async function hasExportableFiles(wsPath) {
  try { await stat(`${wsPath}/opencode.json`); return true; }
  catch {}
  try { return (await readdir(`${wsPath}/.opencode`)).length > 0; }
  catch { return false; }
}

Type guard

function isNonEmptyWorkspace(hasConfig) {
  return hasConfig === true;
}

Try / catch

try {
  await exportWorkspaceConfig({ workspace });
} catch (err) {
  if (err.message === 'No workspace config files found to export') {
    // guide user to create opencode.json or .opencode/ first
  } else throw err;
}

Prevention

When it happens

Trigger: Calling exportWorkspaceConfig on a directory that has no opencode.json and no .opencode/ directory (or where every candidate file was excluded as a secret via isSecretName).

Common situations: Pointing the export at an empty scaffolded project; a fresh workspace before any agent config was created; a workspace where the only config files are .env/.pem style secrets that the exporter deliberately skips.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/f6c3d27cf477d6f7. Report an issue: GitHub.