{"record":{"id":"b6c1170ca388acda","repo":"apache/cassandra","slug":"you-need-to-state-at-least-one-target-host-to-re","errorCode":null,"errorMessage":"You need to state at least one --target host to replay the query against","messagePattern":"You need to state at least one --target host to replay the query against","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/fqltool/src/org/apache/cassandra/fqltool/commands/Replay.java","lineNumber":92,"sourceCode":"    public void run()\n    {\n        try\n        {\n            List<File> resultPaths = null;\n            if (resultPath != null)\n            {\n                File basePath = new File(resultPath);\n                if (!basePath.exists() || !basePath.isDirectory())\n                {\n                    System.err.println(\"The results path (\" + basePath + \") should be an existing directory\");\n                    throw new IllegalArgumentException(\"The results path (\" + basePath + \") should be an existing directory\");\n                }\n                resultPaths = targetHosts.stream().map(target -> new File(basePath, target)).collect(Collectors.toList());\n                resultPaths.forEach(File::mkdir);\n            }\n            if (targetHosts.size() < 1)\n            {\n                throw new IllegalArgumentException(\"You need to state at least one --target host to replay the query against\");\n            }\n            replay(keyspace, arguments, targetHosts, resultPaths, queryStorePath, replayDDLStatements);\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public static void replay(String keyspace, List<String> arguments, List<String> targetHosts, List<File> resultPaths, String queryStorePath, boolean replayDDLStatements)\n    {\n        int readAhead = 200; // how many fql queries should we read in to memory to be able to sort them?\n        List<ChronicleQueue> readQueues = null;\n        List<FQLQueryIterator> iterators = null;\n        List<Predicate<FQLQuery>> filters = new ArrayList<>();\n\n        if (keyspace != null)\n            filters.add(fqlQuery -> fqlQuery.keyspace() == null || fqlQuery.keyspace().equals(keyspace));","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/fqltool/src/org/apache/cassandra/fqltool/commands/Replay.java#L74-L110","documentation":"Replay.run requires at least one --target host to replay recorded queries against; with an empty target list it throws IllegalArgumentException. Comparing query results across replayed hosts is the core purpose of the tool, so at least one target is mandatory.","triggerScenarios":"Running fqltool replay without the --target option or with an empty list.","commonSituations":"Omitting --target in scripts; shell expansion producing an empty argument list.","solutions":["Add at least one --target host:port to the command line","Check the calling script for variables that expand to empty"],"exampleFix":"// before\nfqltool replay --log_path log.bin --results /tmp/r\n// after\nfqltool replay --log_path log.bin --results /tmp/r --target 127.0.0.1:9042","handlingStrategy":"validation","validationCode":"function validateArgs(args) {\n  const targets = [].concat(args.target || []);\n  if (targets.length < 1) throw new Error('at least one --target host is required');\n}","typeGuard":"const hasTargets = args => Array.isArray(args.target) && args.target.length > 0;","tryCatchPattern":"try { runReplay(args); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"--target host\")) { usage(\"specify --target host:port at least once\"); } else throw e; }","preventionTips":["Always pass --target explicitly in scripts","Fail fast on empty shell variables feeding --target","Document required flags in wrapper tooling"],"tags":["cli","configuration","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}