netbirdio/netbird · error

failed to get config: %v

Error message

failed to get config: %v

What it means

The GetConfig RPC to the daemon failed. Note the CLI deliberately drops the gRPC envelope and prints only status.Convert(err).Message(), so what you see is the daemon-side message text, not a transport error string. Failures come in two families: transport (daemon not running, socket/named pipe unreachable) — where the message is typically 'failed to connect...' or 'error reading from server' — and handler-level refusals from the daemon (unknown profile, user mismatch).

Source

Thrown at client/cmd/debug.go:138

	}

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

	client := proto.NewDaemonServiceClient(conn)
	resp, err := client.GetConfig(cmd.Context(), &proto.GetConfigRequest{
		ProfileName: string(activeProf.ID),
		Username:    currUser.Username,
	})
	if err != nil {
		return fmt.Errorf("failed to get config: %v", status.Convert(err).Message())
	}

	// Use protojson so well-known fields render correctly; emit defaults so
	// the operator sees every field even when zero/empty.
	m := protojson.MarshalOptions{Multiline: true, Indent: "  ", EmitUnpopulated: true}
	out, err := m.Marshal(resp)
	if err != nil {
		return fmt.Errorf("marshal config: %w", err)
	}
	cmd.Println(string(out))
	return nil
}

// debugBundle requests the daemon to create a debug bundle and prints
// the resulting local file path and, if uploaded, the uploaded file
// key. It uses the package flags (anonymize, system info, log file
// count, CLI version, optional upload URL) to configure the bundle
// request. Returns an error if the RPC fails or if the daemon reports

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Verify the daemon is running and healthy (systemctl status netbird / service logs), start it if needed, then rerun
  2. Compare versions: netbird version (CLI) vs the daemon log banner; align them if an upgrade left them mismatched
  3. If the message names a missing profile, re-run netbird up/login so the daemon and CLI profile stores agree, then retry the dump
  4. Run the command as the user owning the profile and with access to the daemon IPC socket (the same user netbird up was run for)

Example fix

# before: dump attempted while the service is stopped
netbird debug config-dump
# -> failed to get config: ...

# after: daemon up first
sudo systemctl start netbird && netbird debug config-dump
Defensive patterns

Strategy: retry

Validate before calling

// Verify the daemon IPC endpoint answers before the RPC:
conn, err := getClient(cmd) // connection already implies socket present
if err != nil { return err }
// optional:Ping service via a cheap RPC (e.g. Status) first
if _, err := proto.NewDaemonServiceClient(conn).Status(cmd.Context(), &proto.EmptyRequest{}); err != nil {
    return fmt.Errorf("daemon unhealthy: %v", status.Convert(err).Message())
}

Try / catch

// Start-stop retry for service-not-yet-up races:
resp, err := client.GetConfig(ctx, req)
for retry := 0; err != nil && retry < 3; retry++ {
    time.Sleep(time.Duration(retry+1) * time.Second)
    resp, err = client.GetConfig(ctx, req)
}
if err != nil {
    return fmt.Errorf("failed to get config: %v", status.Convert(err).Message())
}

Prevention

When it happens

Trigger: Daemon service stopped/crashed while the CLI tried to reach it (transport-level message); GetConfigRequest carries ProfileName/Username of the active profile but the daemon was reconfigured with a different profile set (unknown profile message); upgrading the daemon while an old CLI runs the dump; permission to the IPC socket denied for the calling user.

Common situations: netbird debug config-dump right after boot before the service starts; mixed versions during package upgrades; the daemon restarted with a cleared config directory while the CLI still had a profile pointer; running as a user without IPC access policy.

Related errors


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