grafana/k6 · error

path %q not found in response

Error message

path %q not found in response

What it means

After reading the body, extractSecretFromResponse applies the configured responsePath as a gjson path into the (JSON) response. This error means the path matched nothing — wrong path syntax or a response shape that does not contain that key — so no secret value could be located.

Source

Thrown at internal/secretsource/url/url.go:256

	limitedReader := io.LimitReader(body, maxSecretSize+1)
	data, err := io.ReadAll(limitedReader)
	if err != nil {
		return "", fmt.Errorf("failed to read response body: %w", err)
	}

	if len(data) > maxSecretSize {
		return "", fmt.Errorf("secret response exceeds maximum size of %d bytes", maxSecretSize)
	}

	if responsePath == "" {
		// If no path specified, assume response body is the secret
		return string(data), nil
	}

	result := gjson.GetBytes(data, responsePath)

	if !result.Exists() {
		return "", fmt.Errorf("path %q not found in response", responsePath)
	}

	if result.Type != gjson.String {
		return "", fmt.Errorf("secret value at path %q is not a string (got %s)", responsePath, result.Type)
	}

	return result.String(), nil
}

// retry retries to execute a provided function until it succeeds or the maximum
// number of attempts is hit. It waits with exponential backoff between attempts.
// The backoff calculation is: wait = (base ^ attempt) + random jitter up to 1 second.
// The do function returns an error and a boolean indicating if the error is retryable.
func retry(
	ctx context.Context,
	attempts int,
	baseBackoff time.Duration,
	logger logrus.FieldLogger,

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Correct responsePath to a valid gjson path present in the response, e.g. data.values.mysecret
  2. Inspect an actual response body to find the correct field
  3. Omit responsePath if the whole body is the secret
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/secretsource/url/url.go:256 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/1b29e6123d3c0c4a. Report an issue: GitHub.