quarkusio/quarkus · error · IllegalArgumentException
Illegal path:
Error message
Illegal path:
What it means
GrafanaUtils.toName() converts a dashboard/asset file path into a Grafana-friendly resource name. An empty path cannot be turned into a name, so an IllegalArgumentException is thrown. This indicates the caller passed an empty string where a file path was expected.
Source
Thrown at extensions/observability-devservices/testcontainers/src/main/java/io/quarkus/observability/testcontainers/GrafanaUtils.java:56
provider.put("type", "file");
Map<String, Object> options = new LinkedHashMap<>();
options.put("path", "/otel-lgtm/" + s);
options.put("foldersFromFilesStructure", false);
provider.put("options", options);
providers.add(provider);
consumer.accept(s);
});
StringWriter writer = new StringWriter();
yaml.dump(data, writer);
return writer.toString();
}
private static String toName(String path) {
if (path.isEmpty()) {
throw new IllegalArgumentException("Illegal path: " + path);
}
StringBuilder name = new StringBuilder();
boolean dash = true;
for (int i = 0; i < path.length(); i++) {
char ch = path.charAt(i);
if (dash) {
ch = Character.toUpperCase(ch);
dash = false;
} else {
if (ch == '-') {
dash = true;
ch = ' ';
}
}
name.append(ch);
}
return name.toString();
}View on GitHub (pinned to e1c734241f)
Solutions
- Set the Grafana dashboard/config path to a non-empty valid path
- Check the configuration property feeding the path is actually populated
- Filter empty entries out of any path collection before passing to GrafanaUtils
Example fix
// before
String name = GrafanaUtils.name("");
// after
String name = path == null || path.isEmpty() ? "default-dashboard" : GrafanaUtils.name(path); Defensive patterns
Strategy: validation
Validate before calling
if (path == null || path.isEmpty()) throw new IllegalArgumentException("Dashboard path must be non-empty"); Type guard
static boolean isValidPath(String p) { return p != null && !p.isEmpty(); } Try / catch
try { name = GrafanaUtils.name(path); } catch (IllegalArgumentException e) { name = FALLBACK_NAME; } Prevention
- Validate config-provided paths at startup
- Filter empty strings from path collections
- Fail fast with clear config error messages
When it happens
Trigger: Calling name(...) (which delegates to toName) with an empty path string — e.g. an empty property, unfilled config value, or empty file path list entry used when provisioning Grafana dashboards.
Common situations: Observability dev services config where the dashboard path property is empty or unset; programmatically built path lists containing empty strings.
Related errors
- Unable to determine datasource URL
- Unsupported OTEL protocol:
- Only official eclipse-mosquitto images are supported
- The fixed port must be greater than 0
- Only official rabbitmq images are supported
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/142d6a7f9c643377.
Report an issue: GitHub.