{"record":{"id":"6159210c6408c8b0","repo":"bazelbuild/bazel","slug":"error-reading-params-file-s-s","errorCode":null,"errorMessage":"Error reading params file: %s %s","messagePattern":"Error reading params file: (.+?) (.+?)","errorType":"exception","errorClass":"OptionsParsingException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/google/devtools/common/options/ParamsFilePreProcessor.java","lineNumber":68,"sourceCode":"   * @return A list of arguments suitable for parsing.\n   * @throws OptionsParsingException if the path does not exist.\n   */\n  @Override\n  public List<ArgAndFallbackData> preProcess(List<ArgAndFallbackData> args)\n      throws OptionsParsingException {\n    if (!args.isEmpty() && args.get(0).arg.startsWith(\"@\")) {\n      if (args.size() > 1) {\n        throw new OptionsParsingException(\n            String.format(\n                TOO_MANY_ARGS_ERROR_MESSAGE_FORMAT,\n                Lists.transform(args, argAndFallbackData -> argAndFallbackData.arg)),\n            args.get(0).arg);\n      }\n      Path path = fs.getPath(args.get(0).arg.substring(1));\n      try {\n        return ArgAndFallbackData.wrapWithFallbackData(parse(path), args.get(0).fallbackData);\n      } catch (RuntimeException | IOException e) {\n        throw new OptionsParsingException(\n            String.format(ERROR_MESSAGE_FORMAT, path, e.getMessage()), args.get(0).arg, e);\n      }\n    }\n    return args;\n  }\n\n  /**\n   * Parses the paramsFile and returns a list of argument tokens to be further processed by the\n   * {@link OptionsParser}.\n   *\n   * @param paramsFile The path of the params file to parse.\n   * @return a list of argument tokens.\n   * @throws IOException if there is an error reading paramsFile.\n   * @throws OptionsParsingException if there is an error reading paramsFile.\n   */\n  protected abstract List<String> parse(Path paramsFile)\n      throws IOException, OptionsParsingException;\n}","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/main/java/com/google/devtools/common/options/ParamsFilePreProcessor.java#L50-L86","documentation":"ParamsFilePreProcessor.preProcess catches any RuntimeException or IOException raised while resolving or parsing the '@' params file path, and rethrows as this error with the path and underlying reason. Common underlying causes: the file does not exist, is unreadable, or the params-file parser rejected its contents.","triggerScenarios":"Passing '@nonexistent.txt' as the only argument; a params file with a bad --param_file=file_format value; permission errors or a directory path instead of a file; relative path resolved against the wrong filesystem root.","commonSituations":"CI checkout missing a generated args file; stale absolute path from another machine; params file with Windows line endings or wrong file_format flag; tool generating the file after Bazel starts.","solutions":["Verify the path exists and is readable at the exact location Bazel resolves it (relative to the workspace/invocation cwd)","Ensure the file is generated before the Bazel invocation in the build pipeline","Check the underlying message after the path — for parse issues, fix the params file format (--param_file=file_format=shell|simple|multiline) or quoting","Use an absolute or workspace-relative path that survives CI directory changes"],"exampleFix":"# before\nbazel build @/stale/path/args.txt\n# after\ngen //tools:args && bazel build @bazel-out/k8-fastbuild/bin/tools/args.txt","handlingStrategy":"validation","validationCode":"# Verify the params file resolves before invoking\np=\"${1#@}\"\n[ -f \"$p\" ] || { echo \"params file not found: $p\" >&2; exit 2; }\n[ -r \"$p\" ] || { echo \"params file unreadable: $p\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":"Catch OptionsParsingException from preProcess/parse; when the message starts with 'Error reading params file:', surface the underlying IOException reason (missing file, permission) rather than retrying.","preventionTips":["Generate args files in the same build step that runs Bazel","Use workspace-relative or bazel-out paths that exist at invocation time","Pin --param_file=file_format explicitly when files are machine-generated"],"tags":["bazel","options","params-file","io","flag-parsing"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}