t8y2/dbx · error · IllegalArgumentException

Unsupported option:

Error message

Unsupported option: 

What it means

The CLI argument parser (parse) throws IllegalArgumentException when it encounters an argument starting with '-' that it does not recognize as one of the supported flags (--coordinate/-c, --scope, --repo/--repository, --local-repo). Unknown flags are rejected instead of being ignored.

Source

Thrown at plugins/jdbc/src/main/java/app/dbx/jdbc/maven/DbxMavenResolver.java:154

        private String coordinate;
        private String scope = JavaScopes.RUNTIME;
        private Path localRepository = Path.of(System.getProperty("user.home"), ".dbx", "maven");
        private final List<String> repositories = new ArrayList<>();

        private static ResolverOptions parse(String[] args) {
            ResolverOptions options = new ResolverOptions();
            for (int index = 0; index < args.length; index++) {
                String arg = args[index];
                switch (arg) {
                    case "resolve" -> {
                    }
                    case "--coordinate", "-c" -> options.coordinate = value(args, ++index, arg);
                    case "--scope" -> options.scope = value(args, ++index, arg).toLowerCase(Locale.ROOT);
                    case "--repo", "--repository" -> options.repositories.add(value(args, ++index, arg));
                    case "--local-repo" -> options.localRepository = Path.of(value(args, ++index, arg));
                    default -> {
                        if (arg.startsWith("-")) {
                            throw new IllegalArgumentException("Unsupported option: " + arg);
                        }
                        if (options.coordinate == null) {
                            options.coordinate = arg;
                        } else {
                            throw new IllegalArgumentException("Unexpected argument: " + arg);
                        }
                    }
                }
            }
            if (options.repositories.isEmpty()) {
                options.repositories.add(DEFAULT_REPOSITORY);
            }
            return options;
        }

        private static String value(String[] args, int index, String option) {
            if (index >= args.length || args[index].isBlank()) {
                throw new IllegalArgumentException(option + " requires a value");

View on GitHub (pinned to c0390bff16)

Solutions

  1. Use a supported flag: --coordinate/-c, --scope, --repo/--repository, --local-repo
  2. Check the spelling/case of the flag (e.g. --coordinate not --coordinates)
  3. Run with --help or inspect the parse method to see the supported option list

Example fix

// before
java ... DbxMavenResolver --coordinates com.example:foo:1.0
// after
java ... DbxMavenResolver --coordinate com.example:foo:1.0
Defensive patterns

Strategy: validation

Validate before calling

Set<String> SUPPORTED = Set.of("--coordinate","-c","--scope","--repo","--repository","--local-repo");
for (String a : args) {
    if (a.startsWith("-") && !SUPPORTED.contains(a) && !a.contains("=")) {
        throw new IllegalArgumentException("unknown flag: " + a);
    }
}

Try / catch

try {
    Options o = Options.parse(args);
} catch (IllegalArgumentException e) {
    System.err.println(e.getMessage() + "\nUsage: --coordinate/-c, --scope, --repo, --local-repo");
    System.exit(2);
}

Prevention

When it happens

Trigger: Running the resolver with a misspelled or unsupported flag such as --coordinates, -r, or --verbose.

Common situations: Typo in flag name; copying a flag from a different tool; a newer/older version of the tool that does not support the flag; shell scripts passing extra flags.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/e8ea4ce2270ddde2. Report an issue: GitHub.