{"record":{"id":"1dc0ad349b1eec30","repo":"kubernetes/minikube","slug":"err-map-go-doesn-t-exist","errorCode":null,"errorMessage":"err_map.go doesn't exist","messagePattern":"err_map\\.go doesn't exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/extract/extract.go","lineNumber":47,"sourceCode":"\n\t\"k8s.io/minikube/pkg/minikube/extract\"\n)\n\nfunc main() {\n\tpaths := []string{\"cmd\", \"pkg\"}\n\tfunctions := []string{\"translate.T\"}\n\toutDir := \"translations\"\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\tpanic(\"Getting current working directory failed\")\n\t}\n\n\tif strings.Contains(cwd, \"cmd\") {\n\t\tpanic(\"run extract.go from the minikube root directory\")\n\t}\n\n\tif _, err = os.Stat(extract.ErrMapFile); os.IsNotExist(err) {\n\t\tpanic(\"err_map.go doesn't exist\")\n\t}\n\terr = extract.TranslatableStrings(paths, functions, outDir)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n","sourceCodeStart":29,"sourceCodeEnd":55,"githubUrl":"https://github.com/kubernetes/minikube/blob/a899afc0eb0b122b323c7ea5ba8e31e3b4ca4b8e/cmd/extract/extract.go#L29-L55","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nif _, err = os.Stat(extract.ErrMapFile); os.IsNotExist(err) {\n    panic(\"err_map.go doesn't exist\")\n}\n\n// after\nif _, err = os.Stat(extract.ErrMapFile); err != nil {\n    panic(fmt.Errorf(\"stat %s failed: %w\", extract.ErrMapFile, err))\n}","handlingStrategy":"validation","validationCode":"// Pre-flight check before running the extract tool:\nif _, err := os.Stat(\"pkg/minikube/reason/known_issues.go\"); os.IsNotExist(err) {\n    log.Fatal(\"known_issues.go missing: run from the minikube root on a branch that contains pkg/minikube/reason\")\n}\n// Shell equivalent:\n// test -f pkg/minikube/reason/known_issues.go || { echo 'missing err_map source'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["go","filesystem","panic","developer-tooling","relative-path"],"backgroundTag":null,"analyzedSha":"a899afc0eb0b122b323c7ea5ba8e31e3b4ca4b8e","analyzedAt":"2026-08-15T17:03:09.721Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}