netbirdio/netbird · error

failed to set log level to TRACE: %v

Error message

failed to set log level to TRACE: %v

What it means

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.

Source

Thrown at client/cmd/debug.go:282

		return fmt.Errorf("failed to get log level: %v", status.Convert(err).Message())
	}

	if stateWasDown {
		if _, err := client.Up(cmd.Context(), &proto.UpRequest{}); err != nil {
			cmd.PrintErrf("Failed to bring service up: %v\n", status.Convert(err).Message())
		} else {
			cmd.Println("netbird up")
			time.Sleep(time.Second * 10)
		}
	}

	initialLevelTrace := initialLogLevel.GetLevel() >= proto.LogLevel_TRACE
	if !initialLevelTrace {
		_, err = client.SetLogLevel(cmd.Context(), &proto.SetLogLevelRequest{
			Level: proto.LogLevel_TRACE,
		})
		if err != nil {
			return fmt.Errorf("failed to set log level to TRACE: %v", status.Convert(err).Message())
		}
		cmd.Println("Log level set to trace.")
	}

	needsRestoreUp := false
	if _, err := client.Down(cmd.Context(), &proto.DownRequest{}); err != nil {
		cmd.PrintErrf("Failed to bring service down: %v\n", status.Convert(err).Message())
	} else {
		needsRestoreUp = !stateWasDown
		cmd.Println("netbird down")
	}

	time.Sleep(1 * time.Second)

	// Enable sync response persistence before bringing the service up
	if _, err := client.SetSyncResponsePersistence(cmd.Context(), &proto.SetSyncResponsePersistenceRequest{
		Enabled: true,
	}); err != nil {

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Ensure the daemon supports the log-level RPCs: upgrade the service so daemon and CLI are the same release
  2. Restart the netbird service and retry `netbird debug for <duration>`
  3. If it recurs, inspect the daemon log around the SetLogLevel call for the rejection reason
Defensive patterns

Strategy: try-catch

Try / catch

_, err := client.SetLogLevel(ctx, &proto.SetLogLevelRequest{Level: proto.LogLevel_TRACE})
if err != nil {
	if status.Code(err) == codes.Unimplemented {
		return fmt.Errorf("daemon does not support SetLogLevel; upgrade the service: %w", err)
	}
	// transport-level failure: nothing was changed on the daemon, safe to abort
	return fmt.Errorf("set log level: %w", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/1647e546175a9236. Report an issue: GitHub.