{"record":{"id":"254e97a5ed4a41d2","repo":"t8y2/dbx","slug":"maven-coordinate-is-required","errorCode":null,"errorMessage":"Maven coordinate is required","messagePattern":"Maven coordinate is required","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"plugins/jdbc/src/main/java/app/dbx/jdbc/maven/DbxMavenResolver.java","lineNumber":109,"sourceCode":"            artifacts.add(ResolvedArtifact.from(artifact, artifact.getFile()));\n        }\n        for (DependencyNode child : node.getChildren()) {\n            collectRuntimeArtifacts(child, false, artifacts);\n        }\n    }\n\n    private static boolean isRuntimeDependency(Dependency dependency) {\n        if (dependency.isOptional()) {\n            return false;\n        }\n        String scope = dependency.getScope();\n        return scope == null || scope.isBlank() || JavaScopes.COMPILE.equals(scope) || JavaScopes.RUNTIME.equals(scope);\n    }\n\n    private static Artifact parseCoordinate(String coordinate) {\n        String trimmed = coordinate == null ? \"\" : coordinate.trim();\n        if (trimmed.isEmpty()) {\n            throw new IllegalArgumentException(\"Maven coordinate is required\");\n        }\n        String[] parts = trimmed.split(\":\");\n        if (parts.length == 3) {\n            return new DefaultArtifact(parts[0], parts[1], \"\", \"jar\", parts[2]);\n        }\n        if (parts.length == 4) {\n            return new DefaultArtifact(parts[0], parts[1], parts[3], \"jar\", parts[2]);\n        }\n        if (parts.length == 5) {\n            return new DefaultArtifact(parts[0], parts[1], parts[3], parts[2], parts[4]);\n        }\n        return new DefaultArtifact(trimmed);\n    }\n\n    private static String sha256(File file) throws Exception {\n        MessageDigest digest = MessageDigest.getInstance(\"SHA-256\");\n        byte[] bytes = java.nio.file.Files.readAllBytes(file.toPath());\n        byte[] hash = digest.digest(bytes);","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/plugins/jdbc/src/main/java/app/dbx/jdbc/maven/DbxMavenResolver.java#L91-L127","documentation":"DbxMavenResolver.parseCoordinate throws IllegalArgumentException when the Maven coordinate string is null, empty, or only whitespace. Coordinates are parsed by splitting on ':' and require at least 'group:artifact:version'. This fail-fast guard prevents ambiguous downstream artifact resolution errors.","triggerScenarios":"Calling rootArtifact() with a null or blank coordinate, e.g. running the resolver CLI without a positional coordinate and with no --coordinate/-c flag set.","commonSituations":"CLI invoked with no arguments; --coordinate flag forgotten; an empty string passed from a script or CI variable that failed to interpolate.","solutions":["Pass a full Maven coordinate as a positional argument, e.g. com.example:foo:1.2.3","Use the --coordinate/-c flag: --coordinate com.example:foo:1.2.3","Fix the upstream variable in your script/CI so it is not empty before invoking the resolver"],"exampleFix":"// before\nDbxMavenResolver resolver = new DbxMavenResolver(...);\nresolver.rootArtifact(null);\n// after\nresolver.rootArtifact(\"com.example:foo:1.2.3\");","handlingStrategy":"validation","validationCode":"if (coordinate == null || coordinate.isBlank()) {\n    throw new IllegalArgumentException(\"coordinate must be group:artifact:version\");\n}\nString[] parts = coordinate.trim().split(\":\");\nif (parts.length < 3 || parts.length > 4) {\n    throw new IllegalArgumentException(\"expected group:artifact:version[:ext]\");\n}","typeGuard":"static boolean isValidCoordinate(String c) {\n    return c != null && c.trim().matches(\"[\\\\w.-]+:[\\\\w.-]+:[\\\\w.-]+(:[\\\\w.-]+)?\");\n}","tryCatchPattern":"try {\n    resolver.rootArtifact(coordinate);\n} catch (IllegalArgumentException e) {\n    log.error(\"Bad maven coordinate '{}': {}\", coordinate, e.getMessage());\n}","preventionTips":["Validate group:artifact:version shape before calling","Check CLI/script variables for empty values","Quote shell args to avoid splitting"],"tags":["maven","argument-validation","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}