quarkusio/quarkus · error · SpiffeConnectionException
SPIFFE ID path must not have a trailing slash:
Error message
SPIFFE ID path must not have a trailing slash:
What it means
SPIFFE ID paths must not end with a trailing '/'. SpiffeValidator.validateSpiffeId throws SpiffeConnectionException when URI.getPath() ends with '/', since path segments must each name a workload identifier component.
Source
Thrown at extensions/spiffe-client/runtime/src/main/java/io/quarkus/spiffe/client/runtime/internal/SpiffeValidator.java:123
}
if (trustDomain.length() > MAX_TRUST_DOMAIN_LENGTH) {
throw new SpiffeConnectionException("SPIFFE ID trust domain exceeds maximum length of "
+ MAX_TRUST_DOMAIN_LENGTH + " bytes: " + spiffeId);
}
for (int i = 0; i < trustDomain.length(); i++) {
char c = trustDomain.charAt(i);
if (!isValidTrustDomainChar(c)) {
throw new SpiffeConnectionException(
"SPIFFE ID trust domain contains invalid character '" + c + "': " + spiffeId);
}
}
String path = uri.getPath();
if (path == null || path.isEmpty() || "/".equals(path)) {
throw new SpiffeConnectionException("SPIFFE ID must have a non-root path: " + spiffeId);
}
if (path.endsWith("/")) {
throw new SpiffeConnectionException("SPIFFE ID path must not have a trailing slash: " + spiffeId);
}
String[] segments = path.split("/", -1);
for (int i = 1; i < segments.length; i++) {
String segment = segments[i];
if (segment.isEmpty()) {
throw new SpiffeConnectionException(
"SPIFFE ID path must not contain empty segments: " + spiffeId);
}
if (".".equals(segment) || "..".equals(segment)) {
throw new SpiffeConnectionException(
"SPIFFE ID path must not contain dot segments: " + spiffeId);
}
for (int j = 0; j < segment.length(); j++) {
char c = segment.charAt(j);
if (!isValidPathChar(c)) {
throw new SpiffeConnectionException(
"SPIFFE ID path contains invalid character '" + c + "': " + spiffeId);
}View on GitHub (pinned to e1c734241f)
Solutions
- Remove the trailing slash from the path
- Normalize the ID in code: strip trailing '/' before building/validating
- Fix the segment-join logic so no separator is appended after the last segment
Example fix
// before String spiffeId = base + "/ns/default/sa/app/"; // after String normalized = base + "/ns/default/sa/app";
Defensive patterns
Strategy: validation
Validate before calling
static String stripTrailingSlash(String id) {
return id.endsWith("/") ? id.substring(0, id.length() - 1) : id;
} Try / catch
try { validator.validateSpiffeId(id); } catch (SpiffeConnectionException e) { log.warnf("Trailing slash in SPIFFE ID: %s", id); } Prevention
- Normalize IDs (trim trailing '/') at the config-loading boundary
- Fix join loops so separators are only inserted between segments
When it happens
Trigger: validateSpiffeId called with IDs like 'spiffe://example.org/ns/default/sa/app/' or paths built by joining segments with a trailing separator.
Common situations: String-joining path segments with a loop that appends a final '/'; directory-style config values copied with a trailing slash; templating bugs that leave a dangling separator.
Related errors
- SPIFFE ID must have a non-root path:
- SPIFFE ID path must not contain empty segments:
- SPIFFE ID path must not contain dot segments:
- SPIFFE ID must not contain a port: ${spiffeId}
- SPIFFE ID must not contain a query:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/3b8cf4f826562b50.
Report an issue: GitHub.