{"record":{"id":"a95013f303503da4","repo":"SeleniumHQ/selenium","slug":"expected-input-and-output-file-paths","errorCode":null,"errorMessage":"Expected input and output file paths","messagePattern":"Expected input and output file paths","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"javascript/atoms/typescript/strip-trailing-semicolon.js","lineNumber":23,"sourceCode":"// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License.  You may obtain a copy of the License at\n//\n//   http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied.  See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nconst fs = require('node:fs');\n\nconst [inputPath, outputPath] = process.argv.slice(2);\n\nif (!inputPath || !outputPath) {\n  throw new Error('Expected input and output file paths');\n}\n\nconst input = fs.readFileSync(inputPath, 'utf8');\nconst output = input.replace(/;\\s*$/, '');\nfs.writeFileSync(outputPath, output);\n","sourceCodeStart":5,"sourceCodeEnd":29,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/javascript/atoms/typescript/strip-trailing-semicolon.js#L5-L29","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Always invoke with exactly two args: node strip-trailing-semicolon.js <input.js> <output.js>.","If calling from a Bazel rule, verify both $(location //label:target) substitutions resolve to real file paths.","When running manually, pass absolute or workspace-relative paths for both input and output.","Check that the upstream tsc compile step actually produced the input file before this step runs."],"exampleFix":"// before\nnode javascript/atoms/typescript/strip-trailing-semicolon.js out.js\n\n// after\nnode javascript/atoms/typescript/strip-trailing-semicolon.js out.js out.fixed.js","handlingStrategy":"validation","validationCode":"const [inputPath, outputPath] = process.argv.slice(2)\nif (!inputPath || !outputPath) {\n  console.error('Usage: strip-trailing-semicolon.js <input> <output>')\n  process.exit(2)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass exactly two positional path arguments.","In Bazel rules, use $(location) for both input and output labels.","Prefer running the Bazel target over invoking the script directly.","Verify the upstream compile produced the input file."],"tags":["build","nodejs","bazel","atoms","cli","typescript"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}