{"record":{"id":"841f65d50d4dbc5c","repo":"paperclipai/paperclip","slug":"invalid-ssh-environment-variable-key-key","errorCode":null,"errorMessage":"Invalid SSH environment variable key: ${key}","messagePattern":"Invalid SSH environment variable key: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-utils/src/ssh.ts","lineNumber":1211,"sourceCode":"  config: SshConnectionConfig,\n  remoteCommand: string,\n  options: {\n    env?: Record<string, string>;\n    stdin?: string;\n    timeoutMs?: number;\n    maxBuffer?: number;\n  } = {},\n): Promise<SshCommandResult> {\n  let cleanup: () => Promise<void> = () => Promise.resolve();\n  try {\n    const auth = await createSshAuthArgs(config);\n    cleanup = auth.cleanup;\n    const sshArgs = [...auth.args];\n    const envEntries = Object.entries(options.env ?? {})\n      .filter((entry): entry is [string, string] => typeof entry[1] === \"string\");\n    for (const [key] of envEntries) {\n      if (!isValidShellEnvKey(key)) {\n        throw new Error(`Invalid SSH environment variable key: ${key}`);\n      }\n    }\n\n    // Mirror buildSshSpawnTarget: source the login profiles first, then run\n    // `env KEY=VAL cmd` so user-supplied identity overrides win over anything a\n    // profile re-exports. The SSH target is an operator-configured host, not a\n    // Paperclip sandbox image, so it can expose `node` or an agent CLI only\n    // through a login profile; a non-login SSH command would miss that PATH.\n    // Source `/etc/profile` first so a host that exposes the PATH through\n    // `/etc/profile.d` scripts still resolves node and the agent CLI.\n    // The script no longer sources `nvm.sh`; a profile that adds nvm still runs.\n    // .bash_profile typically sources .bashrc itself; only source .bashrc\n    // directly when no .bash_profile exists, so a host that adds nvm in\n    // .bashrc still resolves node without a double-run of the setup.\n    const envArgs = envEntries.map(([key, value]) => `${key}=${shellQuote(value)}`);\n    const remoteScript = [\n      'if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1 || true; fi',\n      'if [ -f \"$HOME/.profile\" ]; then . \"$HOME/.profile\" >/dev/null 2>&1 || true; fi',","sourceCodeStart":1193,"sourceCodeEnd":1229,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/adapter-utils/src/ssh.ts#L1193-L1229","documentation":"Error \"Invalid SSH environment variable key: ${key}\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at packages/adapter-utils/src/ssh.ts:1211 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid SSH environment variable key (letters, digits, underscore; not starting with a digit)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}