JuliusBrussee/caveman · error
bedrock: missing credential
Error message
bedrock: missing credential
What it means
credentialAuthKind infers the auth kind when credential.AuthKind is empty. With no AuthKind and an empty Key there is nothing to authenticate with, so it errors rather than passing an unsigned/empty credential upstream.
Solutions
- Set the credential key: either a Bedrock API key or accessKeyId:secretAccessKey[:sessionToken] in x-cave-upstream-key
- Explicitly set AuthKind ("bedrock_api_key" or "aws_access_keys") along with the Key so inference is not needed
- Check the proxy config/env to confirm the credential source is actually populated and the field name matches
Example fix
// before // x-cave-upstream-key not set for bedrock provider // after // x-cave-upstream-key: AKIA...:wJalr... (IAM) or <bedrock-api-key>
Defensive patterns
Strategy: validation
Validate before calling
func hasBedrockCredential(cred providers.Credential) bool {
return strings.TrimSpace(cred.AuthKind) != "" || strings.TrimSpace(cred.Key) != ""
}
if !hasBedrockCredential(cred) { return errors.New("bedrock provider requires x-cave-upstream-key") } Prevention
- Fail fast at startup if the Bedrock provider is enabled without a key
- Verify env var/secret names at config load
- Document required credential fields for the provider
When it happens
Trigger: credential.AuthKind is "" (or whitespace) and credential.Key is also empty/whitespace when SanitizeAndMapHeaders resolves the Bedrock credential.
Common situations: Bedrock provider configured without x-cave-upstream-key set; a stored connection whose secret was deleted or rotated away; env var for the key unset so the credential struct is zero-valued; typo in the header/config key name so the value never lands in Key.
Related errors
- ErrSigV4Configuration
- AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set…
- bedrock base url invalid
- bedrock configured endpoint kind
- bedrock: invalid API key
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/0fb30c98bd0bc135.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/providers/bedrock/signing.go:203
return "", fmt.Errorf("bedrock: exact request payload hash is unavailable")
}
defer body.Close()
raw, err := io.ReadAll(body)
if err != nil {
return "", fmt.Errorf("bedrock: exact request payload hash is unavailable")
}
return awssig.HashPayload(raw), nil
}
func credentialAuthKind(credential providers.Credential) (string, error) {
kind := strings.ToLower(strings.TrimSpace(credential.AuthKind))
switch kind {
case "bedrock_api_key", "aws_access_keys":
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]"View on GitHub (pinned to 3ee70a1026)