{"record":{"id":"f63647193bc86b25","repo":"zhisheng17/flink-learning","slug":"sql-submit-w-work-space-dir-f-sql-file-t","errorCode":null,"errorMessage":"./sql-submit -w <work_space_dir> -f <sql-file> -t <isTest:true|false> -b true -k8d flink","messagePattern":"\\./sql-submit -w <work_space_dir> -f <sql-file> -t <isTest:true\\|false> -b true -k8d flink","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-learning-sql/flink-learning-sql-client/src/main/java/com/zhisheng/sql/cli/CliOptionsParser.java","lineNumber":71,"sourceCode":"\n    public static final Options CLIENT_OPTIONS = getClientOptions(new Options());\n\n    public static Options getClientOptions(Options options) {\n        options.addOption(OPTION_SQL_FILE);\n        options.addOption(OPTION_WORKING_SPACE);\n        options.addOption(OPTION_ISTEST);\n        options.addOption(OPTION_ISBATCH);\n        options.addOption(OPTION_K8S_ID);\n        return options;\n    }\n\n    // --------------------------------------------------------------------------------------------\n    //  Line Parsing\n    // --------------------------------------------------------------------------------------------\n\n    public static CliOptions parseClient(String[] args) {\n        if (args.length < 1) {\n            throw new RuntimeException(\"./sql-submit -w <work_space_dir> -f <sql-file> -t <isTest:true|false> -b true -k8d flink\");\n        }\n        try {\n            DefaultParser parser = new DefaultParser();\n            CommandLine line = parser.parse(CLIENT_OPTIONS, args, true);\n            return new CliOptions(\n                    line.getOptionValue(CliOptionsParser.OPTION_SQL_FILE.getOpt()),\n                    line.getOptionValue(CliOptionsParser.OPTION_WORKING_SPACE.getOpt()),\n                    line.getOptionValue(CliOptionsParser.OPTION_ISTEST.getOpt()),\n                    line.getOptionValue(CliOptionsParser.OPTION_ISBATCH.getOpt()),\n                    line.getOptionValue(CliOptionsParser.OPTION_K8S_ID.getOpt())\n            );\n        } catch (ParseException e) {\n            throw new SqlParserException(e.getMessage());\n        }\n    }\n}\n","sourceCodeStart":53,"sourceCodeEnd":88,"githubUrl":"https://github.com/zhisheng17/flink-learning/blob/d731cee7618021be56d132cc925102ffff8d75e6/flink-learning-sql/flink-learning-sql-client/src/main/java/com/zhisheng/sql/cli/CliOptionsParser.java#L53-L88","documentation":"CliOptionsParser.parseClient throws this RuntimeException with a usage string when sql-submit is invoked with no arguments (args.length < 1). It is a hard guard telling the user the required command-line form; only after this check does it parse CLIENT_OPTIONS.","triggerScenarios":"Running ./sql-submit with zero arguments, or invoking parseClient(new String[0]) programmatically.","commonSituations":"Running the script bare to 'see help' (it throws instead of printing friendly usage), shell wrapper dropping arguments, or quoting issues that collapse all args into nothing.","solutions":["Pass the required options: ./sql-submit -w <work_space_dir> -f <sql-file> plus optional -t, -b, -k8d flags.","Check your wrapper script so arguments are forwarded: sql-submit \"$@\" not sql-submit.","Inspect the CLIENT_OPTIONS definition in CliOptionsParser for the full accepted flags."],"exampleFix":"// before\n./sql-submit\n// after\n./sql-submit -w /opt/sql-workspace -f jobs/my_job.sql -t true -b true -k8d flink","handlingStrategy":"validation","validationCode":"if (args == null || args.length == 0) {\n    System.err.println(\"Usage: ./sql-submit -w <work_space_dir> -f <sql-file> [-t true|false] [-b true] [-k8d flink]\");\n    System.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n    CliOptions opts = CliOptionsParser.parseClient(args);\n} catch (RuntimeException e) {\n    System.err.println(\"Usage: ./sql-submit -w <work_space_dir> -f <sql-file> -t <isTest> -b true -k8d flink\");\n}","preventionTips":["Forward all arguments in wrapper scripts (\"$@\").","Include -w and -f on every invocation; they are the minimum required.","Check the CLI help before scripting calls to sql-submit."],"tags":["cli","argument-validation","sql-client"],"backgroundTag":"missing-cli-argument","analyzedSha":"d731cee7618021be56d132cc925102ffff8d75e6","analyzedAt":"2026-09-06T05:35:08.496Z","contentChangedAt":"2026-09-06T05:35:08.496Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}