JuliusBrussee/caveman · error

kms: invalid API base URL

Error message

kms: invalid API base URL

What it means

Error "kms: invalid API base URL" thrown in JuliusBrussee/caveman.

Source

Thrown at shared/platform/kms/kms.go:102

	decryptKeyIDs := map[string]struct{}{keyID: {}}
	for _, allowedKeyID := range cfg.AllowedDecryptKeyIDs {
		allowedKeyID = strings.TrimSpace(allowedKeyID)
		if err := validateLocation(region, allowedKeyID); err != nil {
			return nil, err
		}
		decryptKeyIDs[allowedKeyID] = struct{}{}
	}
	token := strings.TrimSpace(cfg.AuthToken)
	if len(token) < 20 {
		return nil, errors.New("kms: auth token is required")
	}
	baseURL := strings.TrimRight(strings.TrimSpace(cfg.APIBaseURL), "/")
	if baseURL == "" {
		baseURL = scalewayAPI
	}
	parsed, err := url.Parse(baseURL)
	if err != nil || parsed.Scheme == "" || parsed.Host == "" || parsed.User != nil || parsed.RawQuery != "" || parsed.Fragment != "" {
		return nil, errors.New("kms: invalid API base URL")
	}
	client := cfg.HTTPClient
	if client == nil {
		client = &http.Client{
			Timeout: 8 * time.Second,
			CheckRedirect: func(_ *http.Request, _ []*http.Request) error {
				return http.ErrUseLastResponse
			},
		}
	}
	return &Client{provider: provider, region: region, keyID: keyID, token: token, apiBaseURL: baseURL, httpClient: client, decryptKeyIDs: decryptKeyIDs}, nil
}

// FromEnvironment loads production configuration. Endpoint is not configurable,
// preventing env-driven host redirection of KMS credentials.
func FromEnvironment() (*Client, error) {
	return fromEnvironment(SecretsKeyEnvironment)
}

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Set a valid KMS API base URL.

When it happens

Trigger: Thrown at shared/platform/kms/kms.go:102 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/91efa99b8e10c4bf. Report an issue: GitHub.