{"record":{"id":"dbd9313b2071565e","repo":"netbirdio/netbird","slug":"marshal-config-w","errorCode":null,"errorMessage":"marshal config: %w","messagePattern":"marshal config: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/cmd/debug.go","lineNumber":146,"sourceCode":"\t\t\tlog.Errorf(errCloseConnection, err)\n\t\t}\n\t}()\n\n\tclient := proto.NewDaemonServiceClient(conn)\n\tresp, err := client.GetConfig(cmd.Context(), &proto.GetConfigRequest{\n\t\tProfileName: string(activeProf.ID),\n\t\tUsername:    currUser.Username,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get config: %v\", status.Convert(err).Message())\n\t}\n\n\t// Use protojson so well-known fields render correctly; emit defaults so\n\t// the operator sees every field even when zero/empty.\n\tm := protojson.MarshalOptions{Multiline: true, Indent: \"  \", EmitUnpopulated: true}\n\tout, err := m.Marshal(resp)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshal config: %w\", err)\n\t}\n\tcmd.Println(string(out))\n\treturn nil\n}\n\n// debugBundle requests the daemon to create a debug bundle and prints\n// the resulting local file path and, if uploaded, the uploaded file\n// key. It uses the package flags (anonymize, system info, log file\n// count, CLI version, optional upload URL) to configure the bundle\n// request. Returns an error if the RPC fails or if the daemon reports\n// an upload failure reason.\nfunc debugBundle(cmd *cobra.Command, _ []string) error {\n\tanonymizeEnabled, anonymizeLevel, err := effectiveAnonymize()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconn, err := getClient(cmd)","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/debug.go#L128-L164","documentation":"After a successful GetConfig RPC, the response is rendered with protojson (Multiline, EmitUnpopulated). Marshal errors with valid protobuf messages are practically unreachable: protojson fails only on messages containing types it cannot represent, and GetConfigResponse is a plain config message of scalars/enums/strings produced by the daemon itself. Seeing this error indicates a serious skew, e.g. a CLI linked against an incompatible generated proto version of GetConfigResponse, or memory corruption — not a user misconfiguration.","triggerScenarios":"CLI binary built from one branch against a daemon emitting a response decoded into a mismatched generated type; a hand-modified or downgraded binary mixing generated proto versions; theoretically unsupported well-known type fields introduced into the message in the future.","commonSituations":"Developer mixing build artifacts (stale client/proto generated code vs newer daemon); running an unreleased CLI against an older daemon after proto changes; otherwise essentially never in the field.","solutions":["Rebuild or reinstall the CLI so its generated proto code matches the daemon version (make build / official package of the same release)","Check netbird version vs the daemon version and align them","If you are developing: regenerate protos (client/proto generate scripts) rather than mixing stale generated files","If it persists with matched versions, capture the daemon-side GetConfig response (debug logs) and report it — marshalling a well-formed response should not fail"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Guard the marshalling step so a proto skew fails loudly with context:\nout, err := m.Marshal(resp)\nif err != nil {\n    return fmt.Errorf(\"marshal config (CLI/daemon proto mismatch?): %w\", err)\n}","typeGuard":"// Verify expected shape before marshalling:\nif resp.GetFile() == nil && resp.GetManagementUrl() == \"\" {\n    return errors.New(\"suspicious empty GetConfigResponse; proto version skew suspected\")\n}","tryCatchPattern":null,"preventionTips":["Build CLI and daemon from the same commit or release package","Regenerate protos with the checked-in generate scripts, never mix generated files across branches","Treat this error as a build-integration smell, not a runtime condition"],"tags":["proto","serialization","cli","version-skew","unreachable"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}