{"record":{"id":"87f5843102a42d43","repo":"JanDeDobbeleer/oh-my-posh","slug":"no-active-config-found-87f584","errorCode":null,"errorMessage":"NO ACTIVE CONFIG FOUND","messagePattern":"NO ACTIVE CONFIG FOUND","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/segments/gcp.go","lineNumber":69,"sourceCode":"\t}\n\n\tg.Project = data.Section(\"core\").Key(\"project\").String()\n\tg.Account = data.Section(\"core\").Key(\"account\").String()\n\tg.Region = data.Section(\"compute\").Key(\"region\").String()\n\n\treturn true\n}\n\nfunc (g *Gcp) getActiveConfig(cfgDir string) (string, error) {\n\tactiveCfg := g.env.Getenv(\"CLOUDSDK_ACTIVE_CONFIG_NAME\")\n\tif len(activeCfg) != 0 {\n\t\treturn activeCfg, nil\n\t}\n\n\tap := path.Join(cfgDir, \"active_config\")\n\tactiveCfg = g.env.FileContent(ap)\n\tif activeCfg == \"\" {\n\t\treturn \"\", errors.New(GCPNOACTIVECONFIG)\n\t}\n\n\treturn activeCfg, nil\n}\n\nfunc (g *Gcp) getConfigDirectory() string {\n\tcfgDir := g.env.Getenv(\"CLOUDSDK_CONFIG\")\n\tif len(cfgDir) != 0 {\n\t\treturn cfgDir\n\t}\n\n\tif g.env.GOOS() == runtime.WINDOWS {\n\t\treturn path.Join(g.env.Getenv(\"APPDATA\"), \"gcloud\")\n\t}\n\n\treturn path.Join(g.env.Home(), \".config\", \"gcloud\")\n}\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/gcp.go#L51-L87","documentation":"The gcp segment reads the currently active Google Cloud project from <config-dir>/active_config (gcloud's own file). If the file is empty or absent (and no CLOUDSDK_CORE_PROJECT / project property is set), getActiveConfig() returns GCPNOACTIVECONFIG ('NO ACTIVE CONFIG FOUND') and the segment disables itself.","triggerScenarios":"Enabled() runs while gcloud's active_config file is empty/missing and no project was resolvable from gcloud properties — i.e. gcloud installed but `gcloud config set project` never run, or GOOGLE_CLOUD_DIR/CLOUDSDK_CONFIG points to an empty dir.","commonSituations":"Fresh machine with gcloud installed but never initialized; custom CLOUDSDK_CONFIG directory without an active project; containers/WSL distros with a bare gcloud install.","solutions":["Run `gcloud config set project <project-id>` (or `gcloud init`) to create the active_config file.","If you use a custom config dir (CLOUDSDK_CONFIG), run gcloud init against that configuration.","Disable the gcp segment in your theme if you don't need it in that shell."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"test -s \"${CLOUDSDK_CONFIG:-$HOME/.config/gcloud}/active_config\" || echo 'run: gcloud config set project <id>'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `gcloud init` (or `gcloud config set project`) after installing gcloud.","When using CLOUDSDK_CONFIG, initialize that config dir too.","Keep the gcp segment in its default hide-on-error mode in fresh environments."],"tags":["gcp","gcloud","config-file","segment-disabled"],"backgroundTag":"missing-config-file","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}