grafana/k6 · error
no value
Error message
no value
What it means
Returned by the file-based secret source's Get(key) when the requested key is not present in the parsed file (fss.internal map lookup fails). The file secret source loads a flat key-value file (JSON/YAML, via --secret-source=file=...) into memory, and any key absent from it yields this generic error.
Source
Thrown at internal/secretsource/file/file.go:73
}
}
}
return nil
}
type fileSecretSource struct {
internal map[string]string
filename string
}
func (fss *fileSecretSource) Description() string {
return fmt.Sprintf("file source from %s", fss.filename)
}
func (fss *fileSecretSource) Get(key string) (string, error) {
v, ok := fss.internal[key]
if !ok {
return "", errors.New("no value")
}
return v, nil
}
View on GitHub (pinned to 93accf6570)
Solutions
- Add the missing key to the secrets file with the exact spelling/case used in secret(...)
- Verify the file passed via --secret-source=file=... is the one you edited, and re-run with k6 log level debug to see which source is consulted
- Flatten nested structures: the lookup is a flat map, so {secrets: {key: val}} will not expose 'key'
- List expected keys next to the file (or in CI validation) and diff them before the run
Example fix
# before
# secrets.json: {"db_user": "admin"}
k6 run -l debug --secret-source=file=secrets.json script.js # secret('db_password') -> no value
# after
# secrets.json: {"db_user": "admin", "db_password": "s3cr3t"}
k6 run -l debug --secret-source=file=secrets.json script.js Defensive patterns
Strategy: validation
Validate before calling
# Diff required keys against the file before running:
jq -r 'keys[]' secrets.json | sort > /tmp/have
printf 'db_user\ndb_password\n' | sort > /tmp/want
missing=$(comm -13 /tmp/have /tmp/want)
[ -z "$missing" ] || { echo "secrets file missing: $missing"; exit 1; } Prevention
- Keep a canonical list of secret keys next to the script and validate the file against it in CI
- Use identical key names in script and file; avoid case variants
- Keep the secrets file flat; the source does a flat map lookup
When it happens
Trigger: Calling secret('db_password') when the secrets file contains no db_password entry; key typos or case mismatches (DB_PASSWORD vs db_password); pointing --secret-source=file at the wrong file or a file whose top-level structure nests the keys under another object so the flat map misses them; referencing a key added to a different environment's file.
Common situations: Dev/prod secrets files drifting out of sync; renaming a secret in the app but not in the file; YAML indentation mistakes putting keys under a nested parent; using an OS path vs key confusion in CI.
Related errors
- cloud secrets not configured: no secrets configuration avail
- no value
- urlTemplate is required
- tests with unspecified duration are not allowed when outputt
- both K6_CLOUD_METRICS_PUSH_URL and K6_CLOUD_TEST_RUN_TOKEN m
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/021a2f3110b52366.
Report an issue: GitHub.