{"record":{"id":"6cb65685f5d82850","repo":"juanfont/headscale","slug":"marshalling-yaml-output-w","errorCode":null,"errorMessage":"marshalling YAML output: %w","messagePattern":"marshalling YAML output: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/utils.go","lineNumber":303,"sourceCode":"\tswitch outputFormat {\n\tcase outputFormatJSON:\n\t\tb, err := json.MarshalIndent(result, \"\", \"\\t\")\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"marshalling JSON output: %w\", err)\n\t\t}\n\n\t\treturn string(b), nil\n\tcase outputFormatJSONLine:\n\t\tb, err := json.Marshal(result)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"marshalling JSON-line output: %w\", err)\n\t\t}\n\n\t\treturn string(b), nil\n\tcase outputFormatYAML:\n\t\tb, err := yaml.Marshal(result)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"marshalling YAML output: %w\", err)\n\t\t}\n\n\t\treturn string(b), nil\n\tdefault:\n\t\treturn override, nil\n\t}\n}\n\n// printOutput formats result and writes it to stdout. It reads the --output\n// flag from cmd to decide the serialisation format.\nfunc printOutput(cmd *cobra.Command, result any, override string) error {\n\tformat, _ := cmd.Flags().GetString(\"output\")\n\n\tout, err := formatOutput(result, override, format)\n\tif err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/utils.go#L285-L321","documentation":"Error \"marshalling YAML output: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at cmd/headscale/cli/utils.go:303 when the library encounters an invalid state.","commonSituations":"Serializing the result to YAML failed. Check for incompatible CLI/server versions producing unserializable fields.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (marshalling YAML output); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (marshalling YAML output); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}