argoproj/argo-workflows · error
expected bearer token to be a JWT and therefore have 3 dot-d
Error message
expected bearer token to be a JWT and therefore have 3 dot-delimited parts
What it means
ClaimSetWithBearerToken split the bearer token on '.' and did not get 3 parts, so the token is not a JWT and its claims cannot be extracted. This guards the server-auth mode where the server's own SA token is decoded into an identity.
Source
Thrown at server/auth/serviceaccount/claims.go:47
return ClaimSetWithX509(restConfig)
}
return nil, nil
}
func ClaimSetWithBearerToken(restConfig *rest.Config) (*types.Claims, error) {
bearerToken := restConfig.BearerToken
if bearerToken == "" {
// should only ever be used for service accounts
data, err := os.ReadFile(restConfig.BearerTokenFile)
if err != nil {
return nil, fmt.Errorf("failed to read bearer token file: %w", err)
}
bearerToken = string(data)
}
parts := strings.SplitN(bearerToken, ".", 3)
if len(parts) != 3 {
return nil, fmt.Errorf("expected bearer token to be a JWT and therefore have 3 dot-delimited parts")
}
payload := parts[1]
data, err := base64.RawStdEncoding.DecodeString(payload)
if err != nil {
return nil, fmt.Errorf("failed to decode bearer token's JWT payload: %w", err)
}
claims := &types.Claims{}
err = json.Unmarshal(data, &claims)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal bearer token's JWT payload: %w", err)
}
// attempt to derive SA name and namespace from Subject
// "system:serviceaccount:argo:jenkins" -> "argo", "jenkins"
// note that the SA name can have a colon in it, although the rest cannot
parts = strings.SplitN(claims.Subject, ":", 4)
if len(parts) < 4 {View on GitHub (pinned to 35bff19146)
Solutions
- Ensure the configured bearer token is a JWT (standard Kubernetes SA tokens are)
- Use a token file containing the full three-segment JWT
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at server/auth/serviceaccount/claims.go:47 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/451d3745f20004b3.
Report an issue: GitHub.