{"record":{"id":"3b23ba4f159dbe4b","repo":"netbirdio/netbird","slug":"get-config-file-v","errorCode":null,"errorMessage":"get config file: %v","messagePattern":"get config file: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/up.go","lineNumber":229,"sourceCode":"\n\tconfigFilePath, err := activeProf.FilePath()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get active profile file path: %v\", err)\n\t}\n\n\tic, err := setupConfig(customDNSAddressConverted, cmd, configFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"setup config: %v\", err)\n\t}\n\n\tprovidedSetupKey, err := getSetupKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfig, err := profilemanager.UpdateOrCreateConfig(*ic)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get config file: %v\", err)\n\t}\n\n\t_, _ = profilemanager.UpdateOldManagementURL(ctx, config, configFilePath)\n\n\t// Restore residual state left by a previous run that did not shut down\n\t// cleanly, mirroring what the daemon does before connecting: it recovers\n\t// DNS config (a stale resolv.conf takeover can make the management\n\t// hostname unresolvable), firewall rules, ssh config and legacy routing.\n\t// Route cleanup itself happens at engine start; nbnet.Init() below lets\n\t// the management dial bypass a leftover fwmark rule until then.\n\t// Foreground mode is particularly exposed in containers: a crashed\n\t// container restarts inside the same (pod) network namespace, so stale\n\t// state survives while the process does not.\n\tif err := server.RestoreResidualState(ctx, profilemanager.NewServiceManager(configPath).GetStatePath()); err != nil {\n\t\tlog.Warnf(\"failed to restore residual state: %v\", err)\n\t}\n\n\t// Enable advanced routing (as the daemon does on startup) so the","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L211-L247","documentation":"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.","triggerScenarios":"'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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if f, err := os.OpenFile(configFilePath, os.O_RDWR|os.O_CREATE, 0600); err != nil {\n    log.Fatalf(\"config path %s not writable: %v\", configFilePath, err)\n} else { f.Close() }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","foreground","config","filesystem","netbird"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}