{"record":{"id":"7f08d90e6fe1641e","repo":"pxb1988/dex2jar","slug":"one-jar-file-is-required","errorCode":null,"errorMessage":"One <jar> file is required","messagePattern":"One <jar> file is required","errorType":"exception","errorClass":"HelpException","httpStatus":null,"severity":"error","filePath":"dex-tools/src/main/java/com/googlecode/dex2jar/tools/DecryptStringCmd.java","lineNumber":158,"sourceCode":"        String name = line.substring(idx + 2, idx2);\n\n        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) {","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-tools/src/main/java/com/googlecode/dex2jar/tools/DecryptStringCmd.java#L140-L176","documentation":"DecryptStringCmd requires exactly one input jar as its positional argument. When no arguments are given it throws HelpException(\"One <jar> file is required\"), which prints command help instead of a stack trace.","triggerScenarios":"Running d2j-decrypt-string (or invoking DecryptStringCmd.doCommandLine) with zero positional arguments after the flags.","commonSituations":"Forgetting the jar path, running with only flags like -f or -t, or quoting mistakes that swallow the argument in the shell.","solutions":["Pass the target jar as the last positional argument","Check that shell quoting/redirection didn't consume the argument","Run with --help to see expected usage"],"exampleFix":"// before\nd2j-decrypt-string -f key.txt\n// after\nd2j-decrypt-string -f key.txt app.jar","handlingStrategy":"validation","validationCode":"if (args.length < 1) { System.err.println(\"Usage: d2j-decrypt-string [options] <jar>\"); System.exit(1); }","typeGuard":null,"tryCatchPattern":"try { DecryptStringCmd.main(args); } catch (HelpException e) { System.err.println(e.getMessage()); printUsage(); }","preventionTips":["Always append the jar path as the final positional argument","Check --help for expected argument counts","Quote paths with spaces so they don't split into stray tokens"],"tags":["cli","missing-argument","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"}