netbirdio/netbird · error
get config file: %v
Error message
get config file: %v
What it means
Thrown by runInForegroundMode (client/cmd/up.go:229) when profilemanager.UpdateOrCreateConfig(*ic) fails while reading the existing config at configFilePath or writing the new one. Despite the 'get config file' wording, this is a read/parse/write step: an unparseable existing config, an unwritable directory, or a full disk aborts foreground mode.
Source
Thrown at client/cmd/up.go:229
configFilePath, err := activeProf.FilePath()
if err != nil {
return fmt.Errorf("get active profile file path: %v", err)
}
ic, err := setupConfig(customDNSAddressConverted, cmd, configFilePath)
if err != nil {
return fmt.Errorf("setup config: %v", err)
}
providedSetupKey, err := getSetupKey()
if err != nil {
return err
}
config, err := profilemanager.UpdateOrCreateConfig(*ic)
if err != nil {
return fmt.Errorf("get config file: %v", err)
}
_, _ = profilemanager.UpdateOldManagementURL(ctx, config, configFilePath)
// Restore residual state left by a previous run that did not shut down
// cleanly, mirroring what the daemon does before connecting: it recovers
// DNS config (a stale resolv.conf takeover can make the management
// hostname unresolvable), firewall rules, ssh config and legacy routing.
// Route cleanup itself happens at engine start; nbnet.Init() below lets
// the management dial bypass a leftover fwmark rule until then.
// Foreground mode is particularly exposed in containers: a crashed
// container restarts inside the same (pod) network namespace, so stale
// state survives while the process does not.
if err := server.RestoreResidualState(ctx, profilemanager.NewServiceManager(configPath).GetStatePath()); err != nil {
log.Warnf("failed to restore residual state: %v", err)
}
// Enable advanced routing (as the daemon does on startup) so theView on GitHub (pinned to 93e97f4bf1)
Solutions
- Inspect the config file at the printed profile path and fix or remove it (back it up first - it will be regenerated)
- Make the config directory writable by the running user (chown/chmod)
- Point NB_CONFIG/--config to a writable location and retry
Defensive patterns
Strategy: validation
Validate before calling
if f, err := os.OpenFile(configFilePath, os.O_RDWR|os.O_CREATE, 0600); err != nil {
log.Fatalf("config path %s not writable: %v", configFilePath, err)
} else { f.Close() } Prevention
- Never hand-edit the generated config into invalid syntax; use flags
- Keep config ownership consistent; avoid sudo/non-sudo mixing
- Mount a writable volume for the config path in containers
When it happens
Trigger: 'netbird up --foreground-mode' when the profile's config file was hand-edited into invalid JSON/YAML; the config directory is read-only or owned by another user; NB_CONFIG points at an unwritable path; disk full.
Common situations: Config drift after manual edits; running under sudo once so the file is root-owned, then as the normal user; immutable container filesystems without a writable config volume.
Related errors
- get active profile file path: %v
- get active profile file path: %v
- read config file %s: %v
- get active profile: %v
- setup config: %v
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/3b23ba4f159dbe4b.
Report an issue: GitHub.