{"record":{"id":"c56b1053c455457c","repo":"pxb1988/dex2jar","slug":"only-one-jar-file-is-required-but-we-found","errorCode":null,"errorMessage":"Only one <jar> file is required, But we found ","messagePattern":"Only one <jar> file is required, But we found ","errorType":"exception","errorClass":"HelpException","httpStatus":null,"severity":"error","filePath":"dex-tools/src/main/java/com/googlecode/dex2jar/tools/DecryptStringCmd.java","lineNumber":160,"sourceCode":"        String desc = line.substring(idx2);\n        if (desc.endsWith(\")\")) {\n            desc = desc + \"Ljava/lang/String;\";\n        }\n\n        MethodConfig config = new MethodConfig();\n        config.owner = owner;\n        config.desc = desc;\n        config.name = name;\n        return config;\n\n    }\n\n    @Override\n    protected void doCommandLine() throws Exception {\n        if (remainingArgs.length == 0) {\n            throw new HelpException(\"One <jar> file is required\");\n        } else if (remainingArgs.length > 1) {\n            throw new HelpException(\"Only one <jar> file is required, But we found \" + remainingArgs.length);\n        }\n\n        final Path jar = new File(remainingArgs[0]).toPath();\n        if (!Files.exists(jar)) {\n            System.err.println(jar + \" doesn't exist\");\n            return;\n        }\n        if (output == null) {\n            if (Files.isDirectory(jar)) {\n                output = new File(jar.getFileName() + \"-decrypted.jar\").toPath();\n            } else {\n                output = new File(getBaseName(jar.getFileName().toString()) + \"-decrypted.jar\").toPath();\n            }\n        }\n\n        if (Files.exists(output) && !forceOverwrite) {\n            System.err.println(output + \" exists, use --force to overwrite\");\n            return;","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-tools/src/main/java/com/googlecode/dex2jar/tools/DecryptStringCmd.java#L142-L178","documentation":"Command-line validation in doCommandLine of DecryptStringCmd: more than one positional argument was supplied. The tool decrypts strings in exactly one jar, so any extra positional arguments trigger this HelpException (which normally prints usage) — it is a usage error, not a processing failure.","triggerScenarios":"Running d2j-decrypt-string with two or more positional jar paths, or stray unquoted tokens on the command line being counted as remainingArgs.","commonSituations":"Trying to process multiple jars in one run, or an accidental extra token (unquoted path with spaces) after the jar name.","solutions":["Provide exactly one jar per invocation; loop in a shell script for multiple jars","Quote paths containing spaces so they count as a single argument","Remove stray tokens after the jar argument"],"exampleFix":"// before\nd2j-decrypt-string a.jar b.jar\n// after\nd2j-decrypt-string a.jar && d2j-decrypt-string b.jar","handlingStrategy":"validation","validationCode":"if (args.stream().filter(a -> !a.startsWith(\"-\")).count() > 1)\n    throw new IllegalArgumentException(\"pass exactly one jar\");","typeGuard":null,"tryCatchPattern":"try { DecryptStringCmd.main(args); } catch (HelpException e) { System.err.println(e.getMessage()); System.exit(2); }","preventionTips":["Process multiple jars with a loop, one invocation each","Quote paths containing spaces","Verify final positional args count equals 1 before invoking"],"tags":["cli","too-many-arguments","help"],"backgroundTag":"missing-required-argument","analyzedSha":"b5bda4fb4935ae8b3869b422454ae3b3896c7bc1","analyzedAt":"2026-09-08T00:44:01.258Z","contentChangedAt":"2026-09-08T00:44:01.258Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}