{"record":{"id":"4388a6a5809a020e","repo":"affaan-m/ECC","slug":"executable-must-be-a-non-empty-argv-entry-without","errorCode":null,"errorMessage":"Executable must be a non-empty argv entry without control bytes.","messagePattern":"Executable must be a non-empty argv entry without control bytes\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/terminal-opener/scripts/open-terminal.js","lineNumber":53,"sourceCode":"\nfunction isAbsolutePath(value) {\n  return path.isAbsolute(value) || path.win32.isAbsolute(value);\n}\n\nfunction validateTerminalName(value) {\n  if (!/^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(value)) {\n    throw new Error('Invalid terminal name; use a simple adapter name such as wezterm.');\n  }\n}\n\nfunction validateCwd(value) {\n  if (value.includes('\\0')) throw new Error('--cwd must not contain a NUL byte.');\n  if (!isAbsolutePath(value)) throw new Error('--cwd must be an absolute path.');\n}\n\nfunction validateExecutable(value) {\n  if (!value || /[\\0\\r\\n]/.test(value)) {\n    throw new Error('Executable must be a non-empty argv entry without control bytes.');\n  }\n\n  const whitespaceIndex = value.search(/\\s/);\n  const separatorIndexes = [value.indexOf('/'), value.indexOf('\\\\')].filter(index => index >= 0);\n  const firstSeparatorIndex = separatorIndexes.length > 0 ? Math.min(...separatorIndexes) : -1;\n  const resemblesExecutablePath = isAbsolutePath(value)\n    || (firstSeparatorIndex >= 0 && (whitespaceIndex < 0 || firstSeparatorIndex < whitespaceIndex));\n\n  if (whitespaceIndex >= 0 && !resemblesExecutablePath) {\n    throw new Error(\n      'Executable must be one argv entry, not an interpolated shell command string.'\n    );\n  }\n  if (!resemblesExecutablePath && /[;&|<>`$]/.test(value)) {\n    throw new Error(\n      'Executable must be one argv entry, not an interpolated shell command string.'\n    );\n  }","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/terminal-opener/scripts/open-terminal.js#L35-L71","documentation":"validateExecutable requires the --executable value to be a non-empty single argv entry containing no control bytes (NUL, CR, LF). Empty strings and values with control characters cannot be safely passed as the program name when spawning the terminal, so they are rejected up front.","triggerScenarios":"Passing `--executable \"\"`, a value containing a newline from a multi-line paste or config, or a string with an embedded NUL to open-terminal.js.","commonSituations":"Templated configs that interpolated an empty variable; heredoc/multi-line values that kept a trailing newline; programmatic callers concatenating buffers with control bytes.","solutions":["Provide a concrete executable name or path, e.g. `--executable wezterm` or `--executable /usr/bin/alacritty`.","Strip control characters: `value.replace(/[\\0\\r\\n]/g, '')` before invoking, or trim whitespace-only values.","Fix the config/env source emitting the empty or binary-contaminated value."],"exampleFix":"// before\nconst exe = config.executable ?? ''; // empty\nnode open-terminal.js --executable \"$exe\"\n// after\nconst exe = config.executable?.trim();\nif (exe) node open-terminal.js --executable \"$exe\"","handlingStrategy":"validation","validationCode":"const ok = (v) => typeof v === 'string' && v.length > 0 && !/[\\0\\r\\n]/.test(v);\nif (!ok(exe)) throw new Error('executable must be non-empty without control bytes');","typeGuard":"function isCleanArgvEntry(v) {\n  return typeof v === 'string' && v.length > 0 && !/[\\0\\r\\n]/.test(v);\n}","tryCatchPattern":"try {\n  parseArgs(process.argv);\n} catch (e) {\n  if (/non-empty argv entry without control bytes/.test(e.message)) {\n    console.error('Provide a concrete executable name/path with no control characters');\n  } else throw e;\n}","preventionTips":["Trim and check emptiness of interpolated config values before use.","Strip CR/LF from multi-line pastes and heredocs.","Sanitize buffers converted to strings.","Fail fast on empty optional config fields."],"tags":["cli","validation","argv"],"backgroundTag":"invalid-argument-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}