{"record":{"id":"e4f1c075c0bdc0ab","repo":"tinyhumansai/openhuman","slug":"isolated-workspace-requires-spawn-core-e4f1c0","errorCode":null,"errorMessage":"--isolated-workspace requires --spawn-core","messagePattern":"--isolated-workspace requires --spawn-core","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/harness-cache-audit.mjs","lineNumber":562,"sourceCode":"      return;\n    } catch {\n      await new Promise((resolve) => setTimeout(resolve, 750));\n    }\n  }\n  throw new Error(\n    `timed out waiting for spawned core at ${coreUrl}\\n${stderrFn()}`,\n  );\n}\n\nasync function main() {\n  const opts = parseArgs(process.argv.slice(2));\n  if (!opts.workspace) opts.workspace = await defaultWorkspace();\n\n  let tempWorkspace = \"\";\n  let spawned;\n  if (opts.isolatedWorkspace) {\n    if (!opts.spawnCore)\n      throw new Error(\"--isolated-workspace requires --spawn-core\");\n    tempWorkspace = await mkdtemp(\n      path.join(tmpdir(), \"openhuman-harness-cache-audit-\"),\n    );\n    opts.workspace = path.join(tempWorkspace, \"workspace\");\n    await mkdir(opts.workspace, { recursive: true });\n    await writeAuditDefinitions(opts.workspace);\n  }\n\n  if (opts.spawnCore) {\n    if (!opts.coreUrlExplicit) {\n      const port = await pickFreePort();\n      opts.coreUrl = `http://127.0.0.1:${port}/rpc`;\n    }\n    spawned = await startCore(opts);\n    opts.token = spawned.token;\n  } else {\n    opts.token = await readToken(opts);\n  }","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/harness-cache-audit.mjs#L544-L580","documentation":"CLI usage validation in main() of harness-cache-audit. --isolated-workspace creates a throwaway mkdtemp workspace and writes audit agent definitions into it; only a core spawned by this run (--spawn-core) will serve that fresh directory. An already-running attached core is bound to a different workspace, so the flag combination is rejected up front instead of auditing the wrong data silently.","triggerScenarios":"Invoking `node scripts/debug/harness-cache-audit.mjs --isolated-workspace` without also passing `--spawn-core` — e.g. copied from a longer command line and trimmed, or assuming the script attaches to the desktop app's core while still isolating the workspace.","commonSituations":"Trying to get 'a clean workspace' against an attached core; shell history editing that drops a flag; wrapping the script in tooling that adds --isolated-workspace but not --spawn-core.","solutions":["Add `--spawn-core` so the audit spawns a core against the temp workspace","Or drop `--isolated-workspace` entirely to audit the workspace of the already-running core you are attaching to"],"exampleFix":"# before\nnode scripts/debug/harness-cache-audit.mjs --isolated-workspace\n\n# after\nnode scripts/debug/harness-cache-audit.mjs --isolated-workspace --spawn-core --keep-workspace","handlingStrategy":"validation","validationCode":"const needSpawn = argv.includes(\"--isolated-workspace\");\nif (needSpawn && !argv.includes(\"--spawn-core\")) {\n  console.error(\"--isolated-workspace starts a temp workspace; add --spawn-core\");\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --isolated-workspace/--spawn-core as one unit in wrappers and docs","Wrap invocations in a make/script target that always passes both"],"tags":["cli","validation","flags"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}