derailed/k9s · error
invalid benchmark host %q
Error message
invalid benchmark host %q
What it means
Service.runBenchmark (internal/view/svc.go:154) requires a non-empty cfg.HTTP.Host from the BenchConfig (k9s config `k9s.bench` section) before building the benchmark URL. An empty host means the benchmark feature was invoked without any bench configuration, so there is no target to load-test.
Source
Thrown at internal/view/svc.go:154
}
port, err := s.getExternalPort(svc)
if err != nil {
s.App().Flash().Err(err)
return nil
}
if err := s.runBenchmark(port, &cfg); err != nil {
s.App().Flash().Errf("Benchmark failed %v", err)
s.App().ClearStatus(false)
s.bench = nil
}
return nil
}
// BOZO!! Refactor used by forwards.
func (s *Service) runBenchmark(port string, cfg *config.BenchConfig) error {
if cfg.HTTP.Host == "" {
return fmt.Errorf("invalid benchmark host %q", cfg.HTTP.Host)
}
var err error
base := cfg.HTTP.Host
if !strings.Contains(base, ":") {
base += ":" + port + cfg.HTTP.Path
} else {
base += cfg.HTTP.Path
}
if strings.Index(base, "http") != 0 {
base = "http://" + base
}
if s.bench, err = perf.NewBenchmark(base, s.App().version, cfg); err != nil {
return err
}
s.App().Status(model.FlashWarn, "Benchmark in progress...")View on GitHub (pinned to 2d3ccc6ba2)
Solutions
- Add a bench config with an explicit host to ~/.config/k9s/config.yml (see exampleFix), then restart k9s
- Verify the active k9s context actually matches the bench section you edited
- Validate config syntax after editing (yaml indentation) — a malformed config silently drops the bench stanza
- Alternatively run a load tool directly (hey/wrk) against the service DNS
Example fix
# before: no bench section -> invalid benchmark host ""
k9s:
readOnly: false
# after
k9s:
bench:
default:
bench:
- name: bench
host: http://my-svc.my-ns.svc.cluster.local:8080
suffix: /api/health Defensive patterns
Strategy: validation
Validate before calling
// validate bench config before invoking the benchmark
if cfg == nil || strings.TrimSpace(cfg.HTTP.Host) == "" {
return fmt.Errorf("no bench host configured; add k9s.bench.<context>.bench[].host to config.yml")
} Prevention
- Configure a bench stanza with an explicit host before first use of shift+b
- Restart k9s after editing config.yml so BenchConfig reloads
- Lint the yaml after edits — silent parse failures drop the whole section
When it happens
Trigger: Triggering the service benchmark (shift+b on a service/port-forward) when the config's bench entry for that context has no http.host set — e.g. the default bench entry is missing entirely or exists only with cooldown/threads.
Common situations: Fresh k9s installs without a bench stanza in ~/.config/k9s/config.yml; context-specific bench overrides that omit host; users assuming k9s derives the host from the service automatically.
Related errors
- you must select a reachable service
- k9s config file %q load failed: %w
- main config.yaml load failed: %w
- duplicate input name %q
- default value %q for bool input %q must be "true" or "false"
AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15).
Data as JSON: /api/errors/3b28ed02a537e0c7.
Report an issue: GitHub.