{"record":{"id":"3b28ed02a537e0c7","repo":"derailed/k9s","slug":"invalid-benchmark-host-q","errorCode":null,"errorMessage":"invalid benchmark host %q","messagePattern":"invalid benchmark host %q","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/view/svc.go","lineNumber":154,"sourceCode":"\t}\n\tport, err := s.getExternalPort(svc)\n\tif err != nil {\n\t\ts.App().Flash().Err(err)\n\t\treturn nil\n\t}\n\tif err := s.runBenchmark(port, &cfg); err != nil {\n\t\ts.App().Flash().Errf(\"Benchmark failed %v\", err)\n\t\ts.App().ClearStatus(false)\n\t\ts.bench = nil\n\t}\n\n\treturn nil\n}\n\n// BOZO!! Refactor used by forwards.\nfunc (s *Service) runBenchmark(port string, cfg *config.BenchConfig) error {\n\tif cfg.HTTP.Host == \"\" {\n\t\treturn fmt.Errorf(\"invalid benchmark host %q\", cfg.HTTP.Host)\n\t}\n\n\tvar err error\n\tbase := cfg.HTTP.Host\n\tif !strings.Contains(base, \":\") {\n\t\tbase += \":\" + port + cfg.HTTP.Path\n\t} else {\n\t\tbase += cfg.HTTP.Path\n\t}\n\tif strings.Index(base, \"http\") != 0 {\n\t\tbase = \"http://\" + base\n\t}\n\n\tif s.bench, err = perf.NewBenchmark(base, s.App().version, cfg); err != nil {\n\t\treturn err\n\t}\n\n\ts.App().Status(model.FlashWarn, \"Benchmark in progress...\")","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/svc.go#L136-L172","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before: no bench section -> invalid benchmark host \"\"\nk9s:\n  readOnly: false\n\n# after\nk9s:\n  bench:\n    default:\n      bench:\n        - name: bench\n          host: http://my-svc.my-ns.svc.cluster.local:8080\n          suffix: /api/health","handlingStrategy":"validation","validationCode":"// validate bench config before invoking the benchmark\nif cfg == nil || strings.TrimSpace(cfg.HTTP.Host) == \"\" {\n    return fmt.Errorf(\"no bench host configured; add k9s.bench.<context>.bench[].host to config.yml\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["k9s","benchmark","config","yaml","service"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}