{"record":{"id":"f6c3d27cf477d6f7","repo":"different-ai/openwork","slug":"no-workspace-config-files-found-to-export","errorCode":null,"errorMessage":"No workspace config files found to export","messagePattern":"No workspace config files found to export","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/workspace-archive.mjs","lineNumber":266,"sourceCode":"      createdAt: nowMs(),\n      preset,\n    },\n    authorizedRoots: [targetDir],\n    reload: null,\n  };\n}\n\nexport async function exportWorkspaceConfig({ workspace, outputPath }) {\n  if (!workspace?.path || workspace.workspaceType === \"remote\") {\n    throw new Error(\"Workspace export is only supported for local workspaces\");\n  }\n  const workspaceRoot = workspace.path;\n  if (!(await pathExists(workspaceRoot))) {\n    throw new Error(`Workspace path not found: ${workspaceRoot}`);\n  }\n\n  const { entries, excluded } = await collectWorkspaceEntries(workspaceRoot);\n  if (entries.length === 0) throw new Error(\"No workspace config files found to export\");\n\n  const files = [];\n  const included = [];\n  for (const entry of entries) {\n    files.push({ name: entry.rel, data: await readFile(entry.absolute) });\n    included.push(entry.rel);\n  }\n  files.push({\n    name: \"manifest.json\",\n    data: `${JSON.stringify({\n      version: 1,\n      createdAtMs: nowMs(),\n      workspace: { id: workspace.id, name: workspace.name, path: workspace.path },\n      included,\n      excluded,\n    }, null, 2)}\\n`,\n  });\n  await writeZip(outputPath, files);","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/workspace-archive.mjs#L248-L284","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Create opencode.json or add files under .opencode/ in the workspace, then re-export","Point the export at the correct workspace root that actually contains config","If needed config exists but is secret-named (.env, *.pem), rename/restructure it so it is not excluded"],"exampleFix":"// before\nexportWorkspaceConfig({ workspace: { path: '/tmp/empty-ws' } })  // no config files\n// after\n# add config first\necho '{}' > /tmp/empty-ws/opencode.json\nexportWorkspaceConfig({ workspace: { path: '/tmp/empty-ws' } })","handlingStrategy":"validation","validationCode":"import { readdir, stat } from 'node:fs/promises';\nasync function hasExportableFiles(wsPath) {\n  try { await stat(`${wsPath}/opencode.json`); return true; }\n  catch {}\n  try { return (await readdir(`${wsPath}/.opencode`)).length > 0; }\n  catch { return false; }\n}","typeGuard":"function isNonEmptyWorkspace(hasConfig) {\n  return hasConfig === true;\n}","tryCatchPattern":"try {\n  await exportWorkspaceConfig({ workspace });\n} catch (err) {\n  if (err.message === 'No workspace config files found to export') {\n    // guide user to create opencode.json or .opencode/ first\n  } else throw err;\n}","preventionTips":["Only enable Export after the workspace has opencode.json or .opencode/","Remember secret-named files (.env, *.pem) are excluded from exports","Check the workspace root is the intended project directory"],"tags":["workspace","validation","empty-input"],"backgroundTag":"no-exportable-workspace-files","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}