{"record":{"id":"1647e546175a9236","repo":"netbirdio/netbird","slug":"failed-to-set-log-level-to-trace-v","errorCode":null,"errorMessage":"failed to set log level to TRACE: %v","messagePattern":"failed to set log level to TRACE: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/debug.go","lineNumber":282,"sourceCode":"\t\treturn fmt.Errorf(\"failed to get log level: %v\", status.Convert(err).Message())\n\t}\n\n\tif stateWasDown {\n\t\tif _, err := client.Up(cmd.Context(), &proto.UpRequest{}); err != nil {\n\t\t\tcmd.PrintErrf(\"Failed to bring service up: %v\\n\", status.Convert(err).Message())\n\t\t} else {\n\t\t\tcmd.Println(\"netbird up\")\n\t\t\ttime.Sleep(time.Second * 10)\n\t\t}\n\t}\n\n\tinitialLevelTrace := initialLogLevel.GetLevel() >= proto.LogLevel_TRACE\n\tif !initialLevelTrace {\n\t\t_, err = client.SetLogLevel(cmd.Context(), &proto.SetLogLevelRequest{\n\t\t\tLevel: proto.LogLevel_TRACE,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to set log level to TRACE: %v\", status.Convert(err).Message())\n\t\t}\n\t\tcmd.Println(\"Log level set to trace.\")\n\t}\n\n\tneedsRestoreUp := false\n\tif _, err := client.Down(cmd.Context(), &proto.DownRequest{}); err != nil {\n\t\tcmd.PrintErrf(\"Failed to bring service down: %v\\n\", status.Convert(err).Message())\n\t} else {\n\t\tneedsRestoreUp = !stateWasDown\n\t\tcmd.Println(\"netbird down\")\n\t}\n\n\ttime.Sleep(1 * time.Second)\n\n\t// Enable sync response persistence before bringing the service up\n\tif _, err := client.SetSyncResponsePersistence(cmd.Context(), &proto.SetSyncResponsePersistenceRequest{\n\t\tEnabled: true,\n\t}); err != nil {","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/debug.go#L264-L300","documentation":"Raised by runForDuration when the daemon rejects client.SetLogLevel(TRACE). The command temporarily forces TRACE to capture verbose logs during the debug window, then restores the prior level. Failing here aborts before the Down/Up cycle runs, so the peer's connection state is unchanged by this command.","triggerScenarios":"An older daemon without the SetLogLevel RPC (Unimplemented); the daemon shutting down after the earlier RPCs succeeded; IPC failure on the socket; the command context canceled between calls.","commonSituations":"Same version-skew scenarios as the GetLogLevel failure; a daemon that restarts mid-command; a supervisor (systemd) restarting the service exactly while the debug command runs.","solutions":["Ensure the daemon supports the log-level RPCs: upgrade the service so daemon and CLI are the same release","Restart the netbird service and retry `netbird debug for <duration>`","If it recurs, inspect the daemon log around the SetLogLevel call for the rejection reason"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := client.SetLogLevel(ctx, &proto.SetLogLevelRequest{Level: proto.LogLevel_TRACE})\nif err != nil {\n\tif status.Code(err) == codes.Unimplemented {\n\t\treturn fmt.Errorf(\"daemon does not support SetLogLevel; upgrade the service: %w\", err)\n\t}\n\t// transport-level failure: nothing was changed on the daemon, safe to abort\n\treturn fmt.Errorf(\"set log level: %w\", err)\n}","preventionTips":["Keep daemon and CLI versions identical (check `netbird status` daemon version vs `netbird version`)","Restart the service if it has been running across an upgrade before issuing debug commands","Remember this failure aborts before Down/Up, so no state cleanup is required when you hit it"],"tags":["grpc","log-level","daemon","netbird-cli","version-mismatch"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}