{"record":{"id":"e726a6a6fad0ee2d","repo":"istio/istio","slug":"fail-to-convert-v-v","errorCode":null,"errorMessage":"fail to convert %v: %v","messagePattern":"fail to convert (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"operator/pkg/component/component.go","lineNumber":68,"sourceCode":"func (c Component) Get(merged values.Map) ([]apis.GatewayComponentSpec, error) {\n\tdefaultNamespace := merged.GetPathString(\"metadata.namespace\")\n\tvar defaultResponse []apis.GatewayComponentSpec\n\tdef := c.Default\n\taltEnabled := false\n\tif c.AltEnablementPath != \"\" {\n\t\tif merged.GetPathBool(c.AltEnablementPath) {\n\t\t\tdef = true\n\t\t\taltEnabled = true\n\t\t}\n\t}\n\tif def {\n\t\tdefaultResponse = []apis.GatewayComponentSpec{{ComponentSpec: apis.ComponentSpec{Namespace: defaultNamespace}}}\n\t}\n\n\tbuildSpec := func(m values.Map) (apis.GatewayComponentSpec, error) {\n\t\tspec, err := values.ConvertMap[apis.GatewayComponentSpec](m)\n\t\tif err != nil {\n\t\t\treturn apis.GatewayComponentSpec{}, fmt.Errorf(\"fail to convert %v: %v\", c.SpecName, err)\n\t\t}\n\t\tif spec.Namespace == \"\" {\n\t\t\tspec.Namespace = defaultNamespace\n\t\t}\n\t\tif spec.Namespace == \"\" {\n\t\t\tspec.Namespace = \"istio-system\"\n\t\t}\n\n\t\t// We might copy this later by serializing and then deserializing from JSON.\n\t\t// However, `nil` Go maps get serialized to JSON `null` and desrialized to untyped `nil`.\n\t\t// When Helm tries to index from an untyped nil, it throws an error instead of returning\n\t\t// an empty value. We avoid this issue by explicitly initializing the Go map, so it gets serialized\n\t\t// into an empty JSON object `{}`.\n\t\tif spec.Label == nil {\n\t\t\tspec.Label = make(map[string]string)\n\t\t}\n\t\tspec.Raw = m\n\t\treturn spec, nil","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/istio/istio/blob/8dc789c5cf17517c64e3c36cb3288230f149dfae/operator/pkg/component/component.go#L50-L86","documentation":"The gateway component's buildSpec converts its values.Map into the typed apis.GatewayComponentSpec via values.ConvertMap, which round-trips the untyped map through JSON; the conversion failed for the named c.SpecName. This means the gateway component values cannot unmarshal into the spec schema, almost always a wrong field type or structure under components.ingressGateways or components.egressGateways.","triggerScenarios":"An IstioOperator with a malformed ingress/egress gateway entry: a string where an int or object is expected (replicaCount: \"auto\"), an invalid ports block, or unknown nested structure under a gateway component entry.","commonSituations":"Hand-written gateway values with wrong types; overlays copied from older Istio versions whose spec changed; external values merges that shift a field's type.","solutions":["Audit the gateway component block whose SpecName appears in the error and align field types with the IstioOperator API for your version","Correct scalar types: numbers unquoted, proper lists for ports","Dry-run against the CRD: kubectl apply --dry-run=server -f iop.yaml or istioctl validate","Start from istioctl profile dump default and re-add changes incrementally"],"exampleFix":"// before\ncomponents:\n  ingressGateways:\n    - name: istio-ingressgateway\n      enabled: \"true\"\n// after\ncomponents:\n  ingressGateways:\n    - name: istio-ingressgateway\n      enabled: true","handlingStrategy":"validation","validationCode":"// Pre-flight: convert the gateway component map before install\nif _, err := values.ConvertMap[apis.GatewayComponentSpec](gwMap); err != nil {\n\treturn fmt.Errorf(\"bad gateway values: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run istioctl manifest generate in CI on every IstioOperator change","Keep component values aligned with the version's API reference","Start from istioctl profile dump and change one field at a time"],"tags":["conversion","gateway","istio-operator","json","configuration"],"backgroundTag":null,"analyzedSha":"8dc789c5cf17517c64e3c36cb3288230f149dfae","analyzedAt":"2026-08-15T15:16:55.434Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}