JuliusBrussee/caveman · error

kms: generate probe

Error message

kms: generate probe: %w

What it means

Probe generates 32 random bytes with crypto/rand to run a live encrypt/decrypt round trip; if rand.Read fails the error is wrapped as "kms: generate probe: %w". crypto/rand failing means the OS entropy source is unavailable, which is an environment-level problem, not a KMS problem.

Solutions

  1. Fix the runtime environment's entropy source (ensure /dev/urandom access or getrandom syscall is permitted).
  2. Check seccomp/AppArmor/container policies that may block getrandom(2) and allowlist it.
  3. Upgrade the kernel/base image if running on an OS with a broken RNG.
  4. Retry Probe once entropy is restored — no tenant data is at risk since no API call was made.
Defensive patterns

Strategy: try-catch

Try / catch

if err := client.Probe(ctx); err != nil {
    if strings.Contains(err.Error(), "generate probe") {
        return fmt.Errorf("host RNG unavailable; fix entropy source: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling Probe on a system where the OS CSPRNG cannot serve bytes — depleted entropy pools on old/virtualized kernels, restricted /dev/urandom, or seccomp/container policies blocking getrandom(2).

Common situations: Hardened containers with syscall filters; stripped-down VMs or old kernels lacking getrandom; misconfigured sandboxes in CI.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/8e7022f4309bd2c6. Report an issue: GitHub.

Appendix: source

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

}

// ProbePayloadProduction performs the same live round-trip with the payload KEK.
func ProbePayloadProduction(ctx context.Context) error {
	if !runtimeenv.IsProduction() {
		return nil
	}
	client, err := FromPayloadEnvironment()
	if err != nil {
		return err
	}
	return client.Probe(ctx)
}

// Probe verifies live key access without persisting tenant data.
func (c *Client) Probe(ctx context.Context) error {
	plaintext := make([]byte, 32)
	if _, err := rand.Read(plaintext); err != nil {
		return fmt.Errorf("kms: generate probe: %w", err)
	}
	envelope, err := c.Encrypt(ctx, plaintext)
	if err != nil {
		return fmt.Errorf("kms: probe encrypt: %w", err)
	}
	decrypted, err := c.Decrypt(ctx, envelope)
	if err != nil {
		return fmt.Errorf("kms: probe decrypt: %w", err)
	}
	if !bytes.Equal(decrypted, plaintext) {
		return errors.New("kms: probe plaintext mismatch")
	}
	return nil
}

func validateLocation(region, keyID string) error {
	if !regionPattern.MatchString(region) {
		return errors.New("kms: invalid Scaleway region")

View on GitHub (pinned to 3ee70a1026)