{"record":{"id":"430626247c314ce2","repo":"paperclipai/paperclip","slug":"command-not-found-in-path-command","errorCode":null,"errorMessage":"Command not found in PATH: \"${command}\"","messagePattern":"Command not found in PATH: \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-utils/src/server-utils.ts","lineNumber":2377,"sourceCode":"      args,\n      env: Object.fromEntries(\n        Object.entries(options.remoteEnv ?? {}).filter((entry): entry is [string, string] => typeof entry[1] === \"string\"),\n      ),\n    });\n    return {\n      command: sshResolved,\n      args: spawnTarget.args,\n      cwd: process.cwd(),\n      cleanup: spawnTarget.cleanup,\n    };\n  }\n\n  const resolved = await resolveCommandPath(command, cwd, env);\n  const executable = resolved ?? command;\n\n  if (options.localProcessSandbox) {\n    if (!resolved) {\n      throw new Error(`Command not found in PATH: \"${command}\"`);\n    }\n    const requestedSandboxCommand = options.localProcessSandbox.command?.trim() || \"bwrap\";\n    const sandboxCommand = await resolveCommandPath(requestedSandboxCommand, cwd, env);\n    if (!sandboxCommand) {\n      throw new Error(\n        `Local process confinement requires Bubblewrap, but \"${requestedSandboxCommand}\" was not found in PATH. Install bwrap or configure filesystemSandboxCommand.`,\n      );\n    }\n    const sandboxTarget = await buildLocalProcessSandboxSpawnTarget({\n      executable,\n      args,\n      cwd,\n      options: options.localProcessSandbox,\n    });\n    return { ...sandboxTarget, command: sandboxCommand };\n  }\n\n  if (process.platform !== \"win32\") {","sourceCodeStart":2359,"sourceCodeEnd":2395,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/adapter-utils/src/server-utils.ts#L2359-L2395","documentation":"Thrown by the spawn-target resolver when localProcessSandbox is enabled and the requested command itself is not found in PATH (resolved is null). With sandboxing on, the command must resolve to an absolute executable before it can be wrapped in Bubblewrap, so an unresolved command is an error rather than a deferred exec failure.","triggerScenarios":"Calling the execute/spawn path with options.localProcessSandbox set and a command (e.g. an agent CLI) that resolveCommandPath cannot locate in cwd's PATH. Because sandboxing is on, the null resolution becomes a hard error at line 2377.","commonSituations":"Agent binary not installed or not on PATH; wrong command name configured; PATH differs between the shell that installed the tool and the process running the adapter; a node_modules-local bin not resolved because cwd is wrong.","solutions":["Install the missing agent CLI and confirm `which <command>` finds it in the same PATH the adapter uses.","Pass an absolute path for the command instead of relying on PATH resolution.","Fix the PATH/env passed to the adapter so it includes the tool's bin directory.","If you did not want confinement, disable localProcessSandbox for this run."],"exampleFix":"// before\n{ command: 'codex', localProcessSandbox: {...} }\n// after\n{ command: '/usr/local/bin/codex', localProcessSandbox: {...} }","handlingStrategy":"validation","validationCode":"const resolved = await resolveCommandPath(command, cwd, env);\nif (localProcessSandbox && !resolved) {\n  throw new Error(`Command '${command}' not found; install it or pass an absolute path`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass absolute paths for sandboxed commands instead of relying on PATH.","Verify `which <command>` in the adapter's PATH before enabling confinement.","Keep PATH consistent between install and run."],"tags":["environment","path","sandbox","dependencies","configuration"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}