{"record":{"id":"bb2562fb7bb30f59","repo":"istio/istio","slug":"failed-to-marshal-policies-v","errorCode":null,"errorMessage":"failed to marshal policies: %v","messagePattern":"failed to marshal policies: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"istioctl/pkg/writer/ztunnel/configdump/policies.go","lineNumber":77,"sourceCode":"\t\tfmt.Fprintf(w, \"%v\\t%v\\t%v\\t%v\\n\",\n\t\t\tpol.Namespace, pol.Name, pol.Action, pol.Scope)\n\t}\n\treturn w.Flush()\n}\n\n// PrintPolicyDump prints the relevant services in the config dump to the ConfigWriter stdout\nfunc (c *ConfigWriter) PrintPolicyDump(filter PolicyFilter, outputFormat string) error {\n\tzDump := c.ztunnelDump\n\tpolicies := slices.Filter(zDump.Policies, filter.Verify)\n\tslices.SortFunc(policies, func(a, b *ZtunnelPolicy) int {\n\t\tif r := cmp.Compare(a.Namespace, b.Namespace); r != 0 {\n\t\t\treturn r\n\t\t}\n\t\treturn cmp.Compare(a.Name, b.Name)\n\t})\n\tout, err := json.MarshalIndent(policies, \"\", \"    \")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal policies: %v\", err)\n\t}\n\tif outputFormat == \"yaml\" {\n\t\tif out, err = yaml.JSONToYAML(out); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfmt.Fprintln(c.Stdout, string(out))\n\treturn nil\n}\n","sourceCodeStart":59,"sourceCodeEnd":87,"githubUrl":"https://github.com/istio/istio/blob/8dc789c5cf17517c64e3c36cb3288230f149dfae/istioctl/pkg/writer/ztunnel/configdump/policies.go#L59-L87","documentation":"Error \"failed to marshal policies: %v\" thrown in istio/istio.","triggerScenarios":"Thrown at istioctl/pkg/writer/ztunnel/configdump/policies.go:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8dc789c5cf17517c64e3c36cb3288230f149dfae","analyzedAt":"2026-08-15T15:16:55.434Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}