{"record":{"id":"d98435d929947e3a","repo":"affaan-m/ECC","slug":"invalid-terminal-name-use-a-simple-adapter-name-s","errorCode":null,"errorMessage":"Invalid terminal name; use a simple adapter name such as wezterm.","messagePattern":"Invalid terminal name; use a simple adapter name such as wezterm\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/terminal-opener/scripts/open-terminal.js","lineNumber":42,"sourceCode":"  --standalone       Alias for --recover.\n  --detect           Check whether the selected terminal can be launched.\n  --launch           Explicitly open the terminal (the default only prints a plan).\n  --dry-run          Explicitly print the launch plan without opening a terminal.\n  --json             Emit the plan, capability, or launch result as JSON.\n  --help, -h         Show this help.\n\nAlways pass the executable and arguments as separate entries after --.\nShell command strings are not accepted.\n`;\n}\n\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));","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/terminal-opener/scripts/open-terminal.js#L24-L60","documentation":"validateTerminalName enforces that the --terminal CLI value is a simple adapter identifier matching /^[A-Za-z0-9][A-Za-z0-9_.-]*$/. It must start with an alphanumeric and contain only letters, digits, underscore, dot, or hyphen. Anything containing slashes, spaces, or other characters is rejected to prevent path injection into adapter lookup.","triggerScenarios":"Passing `--terminal \"/usr/bin/wezterm\"`, `--terminal \"my terminal\"`, `--terminal \"wezterm --class foo\"`, or an empty/leading-dash value to open-terminal.js.","commonSituations":"Users pasting a full executable path or command line into --terminal when they should pass a simple name like `wezterm` and use `--executable`/positional args after `--` for the command.","solutions":["Pass only the adapter name, e.g. `--terminal wezterm`.","Move the full command to the executable/args position after `--` instead of embedding it in --terminal.","Remove illegal characters (slashes, spaces, quotes) from the value."],"exampleFix":"// before\nnode open-terminal.js --terminal \"/usr/local/bin/wezterm start\"\n// after\nnode open-terminal.js --terminal wezterm -- /usr/local/bin/wezterm start","handlingStrategy":"validation","validationCode":"const isValidTerminal = (v) => typeof v === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(v);\nif (!isValidTerminal(args.terminal)) throw new Error('terminal must be a simple adapter name');","typeGuard":"function isSimpleAdapterName(v) {\n  return typeof v === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(v);\n}","tryCatchPattern":"try {\n  parseArgs(process.argv);\n} catch (e) {\n  if (/Invalid terminal name/.test(e.message)) {\n    console.error('Usage: --terminal accepts only a simple adapter name, e.g. wezterm');\n  } else throw e;\n}","preventionTips":["Only pass adapter names, never paths or commands, in --terminal.","Validate user input at the CLI boundary with the same regex.","Document --terminal's contract in the tool's help text.","Keep full command lines in args after `--`."],"tags":["cli","validation","terminal"],"backgroundTag":"invalid-cli-argument","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"}