{"record":{"id":"0714a22126066697","repo":"istio/istio","slug":"missing-configuration-map-key-q","errorCode":null,"errorMessage":"missing configuration map key %q","messagePattern":"missing configuration map key %q","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"istioctl/pkg/kubeinject/kubeinject.go","lineNumber":257,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif meshConfigMapName == defaultMeshConfigMapName && revision != \"\" {\n\t\tmeshConfigMapName = fmt.Sprintf(\"%s-%s\", defaultMeshConfigMapName, revision)\n\t}\n\tmeshConfigMap, err := client.Kube().CoreV1().ConfigMaps(ctx.IstioNamespace()).Get(context.TODO(), meshConfigMapName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read valid configmap %q from namespace %q: %v - \"+\n\t\t\t\"Use --meshConfigFile or re-run \"+command+\" with `-i <istioSystemNamespace> and ensure valid MeshConfig exists\",\n\t\t\tmeshConfigMapName, ctx.IstioNamespace(), err)\n\t}\n\t// values in the data are strings, while proto might use a\n\t// different data type.  therefore, we have to get a value by a\n\t// key\n\tconfigYaml, exists := meshConfigMap.Data[configMapKey]\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"missing configuration map key %q\", configMapKey)\n\t}\n\tcfg, err := mesh.ApplyMeshConfigDefaults(configYaml)\n\tif err != nil {\n\t\terr = multierror.Append(err, fmt.Errorf(\"istioctl version %s cannot parse mesh config.  Install istioctl from the latest Istio release\",\n\t\t\tversion.Info.Version))\n\t}\n\treturn cfg, err\n}\n\n// grabs the raw values from the ConfigMap. These are encoded as JSON.\nfunc GetValuesFromConfigMap(ctx cli.Context, revision string) (string, error) {\n\tclient, err := ctx.CLIClient()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif revision != \"\" {\n\t\tinjectConfigMapName = fmt.Sprintf(\"%s-%s\", defaultInjectConfigMapName, revision)","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/istio/istio/blob/8dc789c5cf17517c64e3c36cb3288230f149dfae/istioctl/pkg/kubeinject/kubeinject.go#L239-L275","documentation":"The istio MeshConfig ConfigMap was fetched successfully, but its Data map has no entry for the expected key ('mesh'), so there is no YAML to parse. The control plane normally writes the mesh config under that key; an empty, hand-edited, or foreign object that merely shares the configmap name triggers this.","triggerScenarios":"meshConfigMap.Data[configMapKey] returns exists=false: someone created a placeholder istio configmap with no mesh key, the configmap was edited and the key removed, or a revision label mix-up resolved to an unrelated configmap object.","commonSituations":"Manual edits to the istio configmap that dropped the mesh key; GitOps applying a stripped-down configmap; copying a configmap from another cluster without its data.","solutions":["Inspect the data keys: kubectl get cm istio -n <istio-ns> -o yaml and confirm a 'mesh' key exists","Restore the key by re-applying the Istio install (istioctl install / helm upgrade) or editing the configmap back","For revisioned installs check istio-<rev> instead, matching --revision","Work around with --meshConfigFile <mesh.yaml>"],"exampleFix":"# before (configmap with empty data)\nkubectl get cm istio -n istio-system -o jsonpath='{.data}'  # {}\n# after\nkubectl edit cm istio -n istio-system   # re-add:\n# data:\n#   mesh: |-\n#     defaultConfig: {}\n# or regenerate via: istioctl install","handlingStrategy":"validation","validationCode":"# confirm the mesh key is present before invoking kube-inject\nif ! kubectl get cm istio -n istio-system -o jsonpath='{.data.mesh}' | grep -q .; then\n  echo \"configmap istio has no mesh key\" >&2; exit 1\nfi\nistioctl kube-inject -f app.yaml","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-delete keys from the istio configmap; manage it through istioctl install or helm","Audit GitOps-managed configmaps to ensure the mesh key survives syncs"],"tags":["kubernetes","configmap","istioctl","mesh-config","kube-inject"],"backgroundTag":null,"analyzedSha":"8dc789c5cf17517c64e3c36cb3288230f149dfae","analyzedAt":"2026-08-15T15:16:55.434Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}