JanDeDobbeleer/oh-my-posh · warning
NO ACTIVE CONFIG FOUND
Error message
NO ACTIVE CONFIG FOUND
What it means
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.
Source
Thrown at src/segments/gcp.go:69
}
g.Project = data.Section("core").Key("project").String()
g.Account = data.Section("core").Key("account").String()
g.Region = data.Section("compute").Key("region").String()
return true
}
func (g *Gcp) getActiveConfig(cfgDir string) (string, error) {
activeCfg := g.env.Getenv("CLOUDSDK_ACTIVE_CONFIG_NAME")
if len(activeCfg) != 0 {
return activeCfg, nil
}
ap := path.Join(cfgDir, "active_config")
activeCfg = g.env.FileContent(ap)
if activeCfg == "" {
return "", errors.New(GCPNOACTIVECONFIG)
}
return activeCfg, nil
}
func (g *Gcp) getConfigDirectory() string {
cfgDir := g.env.Getenv("CLOUDSDK_CONFIG")
if len(cfgDir) != 0 {
return cfgDir
}
if g.env.GOOS() == runtime.WINDOWS {
return path.Join(g.env.Getenv("APPDATA"), "gcloud")
}
return path.Join(g.env.Home(), ".config", "gcloud")
}
View on GitHub (pinned to 0976794618)
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.
Defensive patterns
Strategy: fallback
Validate before calling
test -s "${CLOUDSDK_CONFIG:-$HOME/.config/gcloud}/active_config" || echo 'run: gcloud config set project <id>' Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Fresh machine with gcloud installed but never initialized; custom CLOUDSDK_CONFIG directory without an active project; containers/WSL distros with a bare gcloud install.
Related errors
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/87f5843102a42d43.
Report an issue: GitHub.