{"record":{"id":"6e0c679079fb83a0","repo":"tinyhumansai/openhuman","slug":"isolated-workspace-requires-spawn-core","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/goals-live.mjs","lineNumber":543,"sourceCode":"    const toShow = goalsRuns.length ? goalsRuns : changed;\n    if (toShow.length === 0)\n      console.log(\"\\n  (no goals_agent transcript found — run may not persist transcripts)\");\n    for (const t of toShow) printThoughts(t);\n  } else if (goalsRuns.length) {\n    console.log(\"\\n  (re-run with --show-thoughts to see the agent's reasoning + tool calls)\");\n  }\n}\n\n// ── main ────────────────────────────────────────────────────────────────────\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) throw new Error(\"--isolated-workspace requires --spawn-core\");\n    tempWorkspace = await mkdtemp(path.join(tmpdir(), \"openhuman-goals-live-\"));\n    opts.workspace = path.join(tempWorkspace, \"workspace\");\n    await mkdir(opts.workspace, { recursive: true });\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  }\n\n  console.log(\"[goals-live] starting\");\n  console.log(`  rpc:        ${opts.coreUrl}`);","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/goals-live.mjs#L525-L561","documentation":"main() rejects the combination --isolated-workspace without --spawn-core. An isolated workspace means 'create a throwaway temp workspace under $TMPDIR and point a freshly spawned core at it' — an already-running external core cannot be given a new workspace after the fact, so the flag is meaningless without a spawn. The check runs before any temp dir is created.","triggerScenarios":"Running `node scripts/debug/goals-live.mjs --isolated-workspace` while intending to talk to an external core at --core-url; shell alias/history carrying the flag from a previous --spawn-core invocation where it was later dropped; boolean-flag copy-paste from the usage text.","commonSituations":"Developer adds --keep-workspace/--isolated-workspace for a repro case but forgets --spawn-core; scripts/CI wrapper assembling flags conditionally and emitting the isolated flag without the spawn flag.","solutions":["Add --spawn-core: `node scripts/debug/goals-live.mjs --spawn-core --isolated-workspace`","Or drop --isolated-workspace and pass --workspace <dir> to target a specific existing workspace against the external core","If wrapping the script, assert the flag implication when composing argv"],"exampleFix":"# before\nnode scripts/debug/goals-live.mjs --isolated-workspace\n# Error: --isolated-workspace requires --spawn-core\n\n# after\nnode scripts/debug/goals-live.mjs --spawn-core --isolated-workspace --keep-workspace","handlingStrategy":"validation","validationCode":"if (argv.includes(\"--isolated-workspace\") && !argv.includes(\"--spawn-core\")) {\n  console.error(\"--isolated-workspace only means something with --spawn-core; add it or drop the flag\");\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --isolated-workspace/--keep-workspace as a pair that only ever appears together with --spawn-core","In wrapper scripts, model flag implications explicitly (isolated implies spawn) instead of relying on the runner's error"],"tags":["cli","argument-validation","developer-tooling"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}