kubernetes/minikube · error
err_map.go doesn't exist
Error message
err_map.go doesn't exist
What it means
The third guard in extract.go stats extract.ErrMapFile, the constant "pkg/minikube/reason/known_issues.go" (pkg/minikube/extract/extract.go:58), which holds the Advice strings consumed during extraction. If os.Stat reports the file does not exist relative to the current directory, the tool panics with "err_map.go doesn't exist" rather than proceed without advice mappings. In practice this fires when the tool is run from somewhere other than the minikube root, since the path is relative to cwd, or when the checkout genuinely lacks the file (very old branch, partial/shallow clone, or a fresh fork before known_issues.go was added).
Source
Thrown at cmd/extract/extract.go:47
"k8s.io/minikube/pkg/minikube/extract"
)
func main() {
paths := []string{"cmd", "pkg"}
functions := []string{"translate.T"}
outDir := "translations"
cwd, err := os.Getwd()
if err != nil {
panic("Getting current working directory failed")
}
if strings.Contains(cwd, "cmd") {
panic("run extract.go from the minikube root directory")
}
if _, err = os.Stat(extract.ErrMapFile); os.IsNotExist(err) {
panic("err_map.go doesn't exist")
}
err = extract.TranslatableStrings(paths, functions, outDir)
if err != nil {
panic(err)
}
}
View on GitHub (pinned to a899afc0eb)
Solutions
- Confirm your cwd is the minikube root and check the file: `ls pkg/minikube/reason/known_issues.go`.
- If it is missing, sync the checkout (`git checkout master -- pkg/minikube/reason/known_issues.go` or `git pull`) so the file exists at that exact relative path.
- If working in a fork, rebase on upstream minikube so known_issues.go is present.
- If you intentionally moved the file, update the ErrMapFile constant in pkg/minikube/extract/extract.go:58 to the new path.
Example fix
// before
if _, err = os.Stat(extract.ErrMapFile); os.IsNotExist(err) {
panic("err_map.go doesn't exist")
}
// after
if _, err = os.Stat(extract.ErrMapFile); err != nil {
panic(fmt.Errorf("stat %s failed: %w", extract.ErrMapFile, err))
} Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight check before running the extract tool:
if _, err := os.Stat("pkg/minikube/reason/known_issues.go"); os.IsNotExist(err) {
log.Fatal("known_issues.go missing: run from the minikube root on a branch that contains pkg/minikube/reason")
}
// Shell equivalent:
// test -f pkg/minikube/reason/known_issues.go || { echo 'missing err_map source'; exit 1; } Prevention
- Verify `pkg/minikube/reason/known_issues.go` exists (test -f) before invoking the tool.
- Always run from the minikube repository root so relative paths like extract.ErrMapFile resolve.
- Keep forks rebased on upstream minikube so root-only files such as known_issues.go are present.
- If the file moves during a refactor, update the ErrMapFile constant in pkg/minikube/extract/extract.go in the same commit.
When it happens
Trigger: Running `go run cmd/extract/extract.go` from any directory where pkg/minikube/reason/known_issues.go does not resolve (e.g. inside pkg/minikube, or a sibling repo); a shallow or filtered clone that skipped the reason package; a branch predating the introduction of known_issues.go.
Common situations: A maintainer runs the tool from a checkout of an old fork that never had pkg/minikube/reason/known_issues.go; a sparse checkout in CI omitted the pkg/minikube/reason directory; the file was locally deleted or moved by an in-flight refactor and the tool was run before restoring it.
Related errors
AI-assisted analysis of kubernetes/minikube@a899afc0eb (2026-08-15).
Data as JSON: /api/errors/1dc0ad349b1eec30.
Report an issue: GitHub.