{"record":{"id":"03d6af5815a3845f","repo":"paperclipai/paperclip","slug":"ssh-env-lab-fixture-state-exists-but-the-process","errorCode":null,"errorMessage":"SSH env-lab fixture state exists, but the process is not running.","messagePattern":"SSH env-lab fixture state exists, but the process is not running\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/env-lab.ts","lineNumber":205,"sourceCode":"\n  if (opts.json) {\n    printJson(status);\n    return;\n  }\n\n  if (status.ssh.supported) {\n    p.log.success(\"SSH fixture prerequisites are installed.\");\n  } else {\n    p.log.warn(`SSH fixture prerequisites are incomplete: ${status.ssh.reason ?? \"unknown reason\"}`);\n  }\n\n  if (status.ssh.state && status.ssh.running) {\n    p.log.success(\"SSH env-lab fixture is running.\");\n    summarizeFixture(status.ssh.state);\n    p.log.message(`Private key: ${pc.dim(status.ssh.state.clientPrivateKeyPath)}`);\n    p.log.message(`Known hosts: ${pc.dim(status.ssh.state.knownHostsPath)}`);\n  } else if (status.ssh.state) {\n    p.log.warn(\"SSH env-lab fixture state exists, but the process is not running.\");\n    p.log.message(`State: ${pc.dim(status.statePath)}`);\n  } else {\n    p.log.info(\"SSH env-lab fixture is not running.\");\n    p.log.message(`State: ${pc.dim(status.statePath)}`);\n  }\n\n  // The cleanup hint runs the same CLI that prints it, so it stops the correct\n  // version. The bundled build runs `dist/index.js`; a source checkout runs\n  // `src/index.ts` through the checked-out tsx runner. The hint uses absolute\n  // paths, so it works from any working directory. It passes an inert `argv`\n  // value, so no shell reads the argument. See `doc/CLI.md`, \"safe invocation\".\n  //\n  // The doctor diagnoses the instance that `resolvePaperclipInstanceId` selects\n  // from `opts.instance` or the `PAPERCLIP_INSTANCE_ID` environment variable.\n  // The hint pins that resolved instance, so a contributor who pastes the hint\n  // in a shell without `PAPERCLIP_INSTANCE_ID` stops the diagnosed fixture, not\n  // the default instance.\n  const cleanupInstance = resolvePaperclipInstanceId(opts.instance);","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/env-lab.ts#L187-L223","documentation":"env-lab doctor found a fixture state.json (written by a previous `paperclipai env-lab up`) at the printed State path, but the recorded sshd pid is no longer a live process (readSshEnvLabFixtureStatus checks the pid against the expected sshd command line). The state is stale — the fixture is not currently usable.","triggerScenarios":"Machine or container rebooted since `env-lab up`; the sshd fixture process was killed; a new boot reused a different instance root; leftover state file from a crashed session.","commonSituations":"Restarting a dev machine or docker container that previously started the fixture; OOM killer terminating sshd; switching between Paperclip instances with a stale env-lab dir.","solutions":["Run `paperclipai env-lab up` to start a fresh fixture (it rewrites the state).","Or run `paperclipai env-lab down` to clear the stale state if you no longer need the fixture.","If both complain, delete the printed state.json file under the instance env-lab/ssh-fixture directory and re-run up."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const status = await readSshEnvLabFixtureStatus(statePath);\nif (status.state && !status.running) {\n  await stopSshEnvLabFixture({ statePath }); // clear stale state\n  await startSshEnvLabFixture({ statePath }); // or restart fresh\n}","typeGuard":"const isRunningFixture = (s: { state?: unknown; running?: boolean }): s is { state: object; running: true } =>\n  Boolean(s.state) && s.running === true;","tryCatchPattern":null,"preventionTips":["Always stop the fixture (`paperclipai env-lab down`) before rebooting or destroying the environment.","Scripts should check doctor/status output for running === true before using fixture connection details.","Delete state.json under the instance env-lab/ssh-fixture dir when reusing a copied home."],"tags":["env-lab","ssh","stale-state","process","cli"],"backgroundTag":"stale-process-state","analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}