JuliusBrussee/caveman · error
bedrock: unsupported credential auth kind
Error message
bedrock: unsupported credential auth kind
What it means
credentialAuthKind only accepts "bedrock_api_key" and "aws_access_keys". Any other non-empty AuthKind value is rejected with this error, closing the door on typos and unsupported auth schemes for Bedrock.
Solutions
- Change AuthKind to exactly "bedrock_api_key" for Bedrock API key auth
- Change AuthKind to exactly "aws_access_keys" for IAM SigV4 with accessKeyId:secretAccessKey[:sessionToken]
- Remove the AuthKind field entirely and rely on inference from the Key value if you want auto-detection
Example fix
// before
credential := providers.Credential{AuthKind: "api_key", Key: bedrockKey}
// after
credential := providers.Credential{AuthKind: "bedrock_api_key", Key: bedrockKey} Defensive patterns
Strategy: validation
Validate before calling
var validAuthKinds = map[string]bool{"bedrock_api_key": true, "aws_access_keys": true}
if k := strings.ToLower(strings.TrimSpace(cred.AuthKind)); k != "" && !validAuthKinds[k] {
return fmt.Errorf("unsupported AuthKind %q; use bedrock_api_key or aws_access_keys", k)
} Prevention
- Validate AuthKind against an allowlist at config load time
- Use constants instead of string literals for auth kinds
- Do not copy AuthKind values between providers
When it happens
Trigger: credential.AuthKind is a non-empty string other than "bedrock_api_key" or "aws_access_keys" (after lowercasing/trimming) passed into SanitizeAndMapHeaders.
Common situations: Typo like "bedrock_apikey", "api_key", or "sigv4" in the credential config; copying AuthKind values from another provider (e.g. "bearer", "openai_api_key"); uppercase values with unexpected extra characters; leftover config from a migration.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- bedrock base url invalid
- bedrock configured endpoint kind
- bedrock endpoint must be runtime or mantle
- bedrock: invalid API key
- bedrock: missing credential
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/9bfac4b6a18676d0.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/providers/bedrock/signing.go:217
return kind, nil
case "":
key := strings.TrimSpace(credential.Key)
if key == "" {
return "", fmt.Errorf("bedrock: missing credential")
}
// Backward compatibility for existing x-cave-upstream-key and stored
// connection values. A complete colon-form credential remains IAM. An
// AKIA/ASIA-looking partial value fails as IAM instead of being sent as a
// bearer. Every other opaque value is a Bedrock API key.
if _, err := parseAWSCredentials(key); err == nil {
return "aws_access_keys", nil
}
if strings.HasPrefix(key, "AKIA") || strings.HasPrefix(key, "ASIA") {
return "aws_access_keys", nil
}
return "bedrock_api_key", nil
default:
return "", fmt.Errorf("bedrock: unsupported credential auth kind")
}
}
// parseAWSCredentials decodes the "accessKeyId:secretAccessKey[:sessionToken]"
// form carried in x-cave-upstream-key into awssig.Credentials. It fails closed:
// a missing access key or secret is an error, never an unsigned passthrough.
func parseAWSCredentials(raw string) (awssig.Credentials, error) {
if raw == "" {
return awssig.Credentials{}, fmt.Errorf("bedrock: missing AWS credentials in x-cave-upstream-key")
}
parts := strings.SplitN(raw, ":", 3)
if len(parts) < 2 || parts[0] == "" || parts[1] == "" {
return awssig.Credentials{}, fmt.Errorf("bedrock: malformed AWS credentials (want accessKeyId:secretAccessKey[:sessionToken])")
}
creds := awssig.Credentials{AccessKeyID: parts[0], SecretAccessKey: parts[1]}
if len(parts) == 3 {
creds.SessionToken = parts[2]
}View on GitHub (pinned to 3ee70a1026)