{"record":{"id":"85c265676bdf912c","repo":"GoogleContainerTools/skaffold","slug":"invalid-local-registry-hosting-configmap","errorCode":null,"errorMessage":"invalid local-registry-hosting ConfigMap","messagePattern":"invalid local-registry-hosting ConfigMap","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/config/util.go","lineNumber":389,"sourceCode":"func discoverLocalRegistry(ctx context.Context, kubeContext string) (*string, error) {\n\tclientset, err := kubeclient.Client(kubeContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfigMap, err := clientset.CoreV1().ConfigMaps(\"kube-public\").Get(ctx, \"local-registry-hosting\", api_v1.GetOptions{})\n\n\tstatusErr := &api_errors.StatusError{}\n\tswitch {\n\tcase errors.As(err, &statusErr) && statusErr.Status().Code == http.StatusNotFound:\n\t\treturn nil, nil\n\tcase err != nil:\n\t\treturn nil, err\n\t}\n\n\tdata, ok := configMap.Data[\"localRegistryHosting.v1\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"invalid local-registry-hosting ConfigMap\")\n\t}\n\n\tdst := struct {\n\t\tHost *string `yaml:\"host\"`\n\t}{}\n\n\tif err := yaml.Unmarshal([]byte(data), &dst); err != nil {\n\t\treturn nil, errors.New(\"invalid local-registry-hosting ConfigMap\")\n\t}\n\n\treturn dst.Host, nil\n}\n\nfunc IsUpdateCheckEnabled(configfile string) bool {\n\tcfg, err := GetConfigForCurrentKubectx(configfile)\n\tif err != nil {\n\t\treturn true\n\t}","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/config/util.go#L371-L407","documentation":"Skaffold's discoverLocalRegistry reads the 'localRegistryHosting.v1' key from the 'local-registry-hosting' ConfigMap in the kube-system namespace to detect a locally hosted registry. If the ConfigMap exists but lacks that data key, it cannot extract registry hosting info and throws this error. It signals a malformed or non-standard ConfigMap rather than a missing one.","triggerScenarios":"Running skaffold against a cluster where a ConfigMap named local-registry-hosting exists in kube-system but has no 'localRegistryHosting.v1' entry in its data field (e.g. created by a non-conforming tool or edited manually).","commonSituations":"Clusters set up with a partial or hand-written local-registry-hosting ConfigMap; tools writing the ConfigMap with a wrong key name (e.g. 'localRegistryHosting' or 'v1' instead of 'localRegistryHosting.v1'); empty data map after config removal.","solutions":["Inspect the ConfigMap: kubectl -n kube-system get configmap local-registry-hosting -o yaml","Add or fix the data key so it is exactly 'localRegistryHosting.v1' containing a 'host:' field (per KEPS-1755 convention)","If the registry is no longer hosted, delete the ConfigMap so Skaffold can fall back to the default behavior","Verify with a YAML parser that data['localRegistryHosting.v1'] parses as YAML with a host field"],"exampleFix":"// before\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: local-registry-hosting\n  namespace: kube-system\ndata:\n  registry: myregistry:5000\n// after\ndata:\n  localRegistryHosting.v1: |\n    host: localhost:5000\n    help: https://kind.sigs.k8s.io/docs/user/local-registry/","handlingStrategy":"validation","validationCode":"cm, _ := clientset.CoreV1().ConfigMaps(\"kube-system\").Get(ctx, \"local-registry-hosting\", metav1.GetOptions{})\nif cm.Data == nil || cm.Data[\"localRegistryHosting.v1\"] == \"\" {\n    // treat as no local registry; fix the ConfigMap before running skaffold\n}","typeGuard":"func hasLocalRegistryHosting(cm *corev1.ConfigMap) bool {\n    v, ok := cm.Data[\"localRegistryHosting.v1\"]\n    return ok && strings.TrimSpace(v) != \"\"\n}","tryCatchPattern":null,"preventionTips":["Keep the ConfigMap key exactly 'localRegistryHosting.v1'","Validate the ConfigMap YAML against the KEP-1755 schema after edits","Use the upstream kind/local-registry-hosting manifest instead of hand-writing one"],"tags":["kubernetes","configmap","yaml","registry"],"backgroundTag":"missing-config-key","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}