netbirdio/netbird · error

failed to set sync response persistence: %v

Error message

failed to set sync response persistence: %v

What it means

The SetSyncResponsePersistence RPC to the daemon failed during `netbird debug sync-response-persistence <on|off>`. The gRPC status message is surfaced verbatim. This RPC toggles whether the daemon keeps the last management sync response persisted for debugging.

Source

Thrown at client/cmd/debug.go:455

		return err
	}
	defer func() {
		if err := conn.Close(); err != nil {
			log.Errorf(errCloseConnection, err)
		}
	}()

	persistence := strings.ToLower(args[0])
	if persistence != "on" && persistence != "off" {
		return fmt.Errorf("invalid persistence value: %s. Use 'on' or 'off'", args[0])
	}

	client := proto.NewDaemonServiceClient(conn)
	_, err = client.SetSyncResponsePersistence(cmd.Context(), &proto.SetSyncResponsePersistenceRequest{
		Enabled: persistence == "on",
	})
	if err != nil {
		return fmt.Errorf("failed to set sync response persistence: %v", status.Convert(err).Message())
	}

	cmd.Printf("Sync response persistence set to: %s\n", persistence)
	return nil
}

func waitForDurationOrCancel(ctx context.Context, duration time.Duration, cmd *cobra.Command) error {
	ticker := time.NewTicker(1 * time.Second)
	defer ticker.Stop()

	startTime := time.Now()

	done := make(chan struct{})
	go func() {
		defer close(done)
		for {
			select {
			case <-ctx.Done():

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Confirm the daemon is healthy with `netbird status`; restart the service if needed and retry
  2. Check that CLI and daemon versions match (`netbird version` vs the service version in `netbird status`); upgrade the older one
  3. If the gRPC message mentions persistence or storage, inspect the daemon's state directory permissions/free space and its logs
Defensive patterns

Strategy: try-catch

Validate before calling

netbird status >/dev/null 2>&1 || { echo 'daemon down'; exit 1; }

Try / catch

_, err := client.SetSyncResponsePersistence(ctx, &proto.SetSyncResponsePersistenceRequest{Enabled: enabled})
if err != nil {
	switch status.Code(err) {
	case codes.Unimplemented:
		return fmt.Errorf("daemon predates this RPC; upgrade the service: %w", err)
	case codes.Unavailable:
		return fmt.Errorf("daemon unreachable; restart it and retry: %w", err)
	default:
		// storage/persistence failures land here; check daemon logs for the state directory
		return err
	}
}

Prevention

When it happens

Trigger: The daemon went down between the dial and the RPC; the daemon predates this RPC and returns Unimplemented; the daemon failed while writing the persisted state (disk full, read-only or corrupted state directory) and propagated that as a gRPC error.

Common situations: CLI newer than the installed daemon; the service restarting mid-command; a broken or read-only daemon state directory on the host.

Related errors


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