SeleniumHQ/selenium · error · Error

Expected input and output file paths

Error message

Expected input and output file paths

What it means

strip-trailing-semicolon.js is a tiny Node.js build helper that post-processes compiled TypeScript atom output by removing a trailing semicolon. It reads exactly two positional CLI args via process.argv.slice(2) and treats them as [inputPath, outputPath]; if either is missing it throws before any file I/O. It is invoked by Bazel build rules for the TypeScript atoms (isDisplayed/getAttribute/findElements), not by end-user Selenium code.

Source

Thrown at javascript/atoms/typescript/strip-trailing-semicolon.js:23

// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

const fs = require('node:fs');

const [inputPath, outputPath] = process.argv.slice(2);

if (!inputPath || !outputPath) {
  throw new Error('Expected input and output file paths');
}

const input = fs.readFileSync(inputPath, 'utf8');
const output = input.replace(/;\s*$/, '');
fs.writeFileSync(outputPath, output);

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Always invoke with exactly two args: node strip-trailing-semicolon.js <input.js> <output.js>.
  2. If calling from a Bazel rule, verify both $(location //label:target) substitutions resolve to real file paths.
  3. When running manually, pass absolute or workspace-relative paths for both input and output.
  4. Check that the upstream tsc compile step actually produced the input file before this step runs.

Example fix

// before
node javascript/atoms/typescript/strip-trailing-semicolon.js out.js

// after
node javascript/atoms/typescript/strip-trailing-semicolon.js out.js out.fixed.js
Defensive patterns

Strategy: validation

Validate before calling

const [inputPath, outputPath] = process.argv.slice(2)
if (!inputPath || !outputPath) {
  console.error('Usage: strip-trailing-semicolon.js <input> <output>')
  process.exit(2)
}

Prevention

When it happens

Trigger: Running `node strip-trailing-semicolon.js` with zero args, one arg, or undefined args (e.g. a Bazel genrule that failed to substitute $(location) placeholders). Invoking it with only the input path. A broken Bazel rule that passes an empty string for one path.

Common situations: Editing a BUILD.bazel/bzl macro that wires the atom build pipeline and mis-naming the output label. Running the script manually during local debugging without supplying both paths. A Bazel $(location) expansion that resolved to empty because the label was wrong.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/a95013f303503da4. Report an issue: GitHub.