paperclipai/paperclip · error
Invalid exe.dev environment variable key
Error message
Invalid exe.dev environment variable key: ${key} What it means
Env-key sanitization in buildLoginShellScript for the exe.dev driver: an environment variable key failed isValidShellEnvKey, i.e. it is not a valid shell identifier safe to emit in the generated script. Rejecting bad keys here prevents shell metacharacter injection through env var names before the SSH command is built.
Solutions
- Use a valid environment variable key (letters, digits, underscore, not starting with a digit).
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/plugins/sandbox-providers/exe-dev/src/plugin.ts:530 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18).
Data as JSON: /api/errors/b2c077a53ac3bd35.
Report an issue: GitHub.
Appendix: source
Thrown at packages/plugins/sandbox-providers/exe-dev/src/plugin.ts:532
return {
sshIdentityFile,
cleanup: async () => {
await rm(tempDir, { recursive: true, force: true });
},
};
}
function buildLoginShellScript(input: {
command: string;
args: string[];
cwd?: string;
env?: Record<string, string>;
}): string {
const env = input.env ?? {};
for (const key of Object.keys(env)) {
if (!isValidShellEnvKey(key)) {
throw new Error(`Invalid exe.dev environment variable key: ${key}`);
}
}
const envArgs = Object.entries(env)
.filter((entry): entry is [string, string] => typeof entry[1] === "string")
.map(([key, value]) => `${key}=${shellQuote(value)}`);
const commandParts = [shellQuote(input.command), ...input.args.map(shellQuote)].join(" ");
const finalLine = envArgs.length > 0
? `exec env ${envArgs.join(" ")} ${commandParts}`
: `exec ${commandParts}`;
// Source the common login profiles before exec so the command runs with the
// interactive-shell PATH. The wrapper sources no `nvm.sh`; the sandbox image
// supplies node on the PATH.
const lines = [
'if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1 || true; fi',
'if [ -f "$HOME/.profile" ]; then . "$HOME/.profile" >/dev/null 2>&1 || true; fi',
'if [ -f "$HOME/.bash_profile" ]; then . "$HOME/.bash_profile" >/dev/null 2>&1 || true; elif [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" >/dev/null 2>&1 || true; fi',
'if [ -f "$HOME/.zprofile" ]; then . "$HOME/.zprofile" >/dev/null 2>&1 || true; fi',
];View on GitHub (pinned to a7e689b3c3)