grafana/k6 · error
couldn't load the configuration from
Error message
couldn't load the configuration from %q: %w
What it means
Wrapped error from readDiskConfig: reading the k6 configuration file (default ~/.config/loadimpact/k6/config.json or --config path) from disk failed — permission error, unreadable file, etc. A missing default config is silenced, so this fires for real I/O failures on a file that exists.
Solutions
- Check the file exists and is readable by the current user
- Fix the path passed via --config if it points to a directory or wrong location
- Repair file permissions on the config file
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/cmd/config.go:148 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18).
Data as JSON: /api/errors/42ed3457ebc5b412.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cmd/config.go:151
// readDiskConfig reads the configuration file from the supplied filesystem and returns it or
// an error. The only situation in which an error won't be returned is if the
// user didn't explicitly specify a config file path and the default config file
// doesn't exist.
func readDiskConfig(gs *state.GlobalState) (Config, error) {
// Try to see if the file exists in the supplied filesystem
if _, err := gs.FS.Stat(gs.Flags.ConfigFilePath); err != nil {
if errors.Is(err, fs.ErrNotExist) && gs.Flags.ConfigFilePath == gs.DefaultFlags.ConfigFilePath {
// If the file doesn't exist, but it was the default config file (i.e. the user
// didn't specify anything), silence the error
err = nil
}
return Config{}, err
}
data, err := fsext.ReadFile(gs.FS, gs.Flags.ConfigFilePath)
if err != nil {
return Config{}, fmt.Errorf("couldn't load the configuration from %q: %w", gs.Flags.ConfigFilePath, err)
}
var conf Config
err = json.Unmarshal(data, &conf)
if err != nil {
return Config{}, fmt.Errorf("couldn't parse the configuration from %q: %w", gs.Flags.ConfigFilePath, err)
}
return conf, nil
}
// Permissions for the on-disk config file and its containing directory.
// The config can contain the Grafana Cloud API token (collectors.cloud.token),
// so it must not be readable by other local users.
const (
configFileMode = fs.FileMode(0o600)
configDirMode = fs.FileMode(0o700)
)
// writeDiskConfig serializes the configuration to a JSON file and writes it in the suppliedView on GitHub (pinned to 3fcf5388d7)