zhisheng17/flink-learning · error · RuntimeException
./sql-submit -w <work_space_dir> -f <sql-file> -t <isTest:tr
Error message
./sql-submit -w <work_space_dir> -f <sql-file> -t <isTest:true|false> -b true -k8d flink
What it means
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.
Source
Thrown at flink-learning-sql/flink-learning-sql-client/src/main/java/com/zhisheng/sql/cli/CliOptionsParser.java:71
public static final Options CLIENT_OPTIONS = getClientOptions(new Options());
public static Options getClientOptions(Options options) {
options.addOption(OPTION_SQL_FILE);
options.addOption(OPTION_WORKING_SPACE);
options.addOption(OPTION_ISTEST);
options.addOption(OPTION_ISBATCH);
options.addOption(OPTION_K8S_ID);
return options;
}
// --------------------------------------------------------------------------------------------
// Line Parsing
// --------------------------------------------------------------------------------------------
public static CliOptions parseClient(String[] args) {
if (args.length < 1) {
throw new RuntimeException("./sql-submit -w <work_space_dir> -f <sql-file> -t <isTest:true|false> -b true -k8d flink");
}
try {
DefaultParser parser = new DefaultParser();
CommandLine line = parser.parse(CLIENT_OPTIONS, args, true);
return new CliOptions(
line.getOptionValue(CliOptionsParser.OPTION_SQL_FILE.getOpt()),
line.getOptionValue(CliOptionsParser.OPTION_WORKING_SPACE.getOpt()),
line.getOptionValue(CliOptionsParser.OPTION_ISTEST.getOpt()),
line.getOptionValue(CliOptionsParser.OPTION_ISBATCH.getOpt()),
line.getOptionValue(CliOptionsParser.OPTION_K8S_ID.getOpt())
);
} catch (ParseException e) {
throw new SqlParserException(e.getMessage());
}
}
}
View on GitHub (pinned to d731cee761)
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.
Example fix
// before ./sql-submit // after ./sql-submit -w /opt/sql-workspace -f jobs/my_job.sql -t true -b true -k8d flink
Defensive patterns
Strategy: validation
Validate before calling
if (args == null || args.length == 0) {
System.err.println("Usage: ./sql-submit -w <work_space_dir> -f <sql-file> [-t true|false] [-b true] [-k8d flink]");
System.exit(1);
} Try / catch
try {
CliOptions opts = CliOptionsParser.parseClient(args);
} catch (RuntimeException e) {
System.err.println("Usage: ./sql-submit -w <work_space_dir> -f <sql-file> -t <isTest> -b true -k8d flink");
} Prevention
- 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.
When it happens
Trigger: Running ./sql-submit with zero arguments, or invoking parseClient(new String[0]) programmatically.
Common situations: 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.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
AI-assisted analysis of zhisheng17/flink-learning@d731cee761 (2026-09-06).
Data as JSON: /api/errors/f63647193bc86b25.
Report an issue: GitHub.