JanDeDobbeleer/oh-my-posh · error
err executing %s with %v
Error message
err executing %s with %v
What it means
The language segment executed a version command and the process exited with a non-zero exit code (wrapped as runtime.CommandError). oh-my-posh records the exit code and returns 'err executing <executable> with <args>' instead of a version.
Source
Thrown at src/segments/language.go:449
func (l *Language) runCommand(command *cmd) (string, error) {
if command.getVersion == nil {
if !l.env.HasCommand(command.executable) {
return "", errors.New(noVersion)
}
cacheKey, cacheable := l.versionCacheKey(command)
if cacheable {
if cached, found := cache.Device.Get[string](cacheKey); found {
log.Debugf("using cached version output for %s", command.executable)
return cached, nil
}
}
versionStr, err := l.env.RunCommandWithEnv(command.executable, command.envs, command.args...)
if exitErr, ok := err.(*runtime.CommandError); ok {
l.exitCode = exitErr.ExitCode
return "", fmt.Errorf("err executing %s with %v", command.executable, command.args)
}
// Success only: a failed run (a non-CommandError err, or one the
// caller above already turned into an early return) never gets
// cached, so a transient failure cannot pin a bad result for a week.
if err == nil && cacheable {
cache.Device.Set(cacheKey, versionStr, cache.ONEWEEK)
}
return versionStr, nil
}
versionStr, err := command.getVersion()
if err != nil {
return "", err
}
if versionStr == "" {View on GitHub (pinned to 0976794618)
Solutions
- Run the exact command with the same args manually and check the exit code and stderr output
- Fix the underlying tool installation (reinstall, repair PATH resolution, remove broken shim)
- Adjust the segment's command args/envs in the theme config to match the installed tool
- If the tool genuinely lacks a version flag, configure a different command for the segment
Example fix
// before: tool exits 1 because --version is unsupported
"commands": [{ "executable": "java", "args": ["--version"] }]
// after: use the flag the installed JDK supports
"commands": [{ "executable": "java", "args": ["-version"] }] Defensive patterns
Strategy: try-catch
Validate before calling
// verify the tool runs cleanly before relying on the segment
exec.Command("node", "--version").Run() // check err and exit code Try / catch
// segment already captures the exit code; treat the error as terminal
if _, err := segment.SetVersion(); err != nil {
// hide the segment, don't retry
renderFallback()
} Prevention
- Manually run the exact command+args from the theme config after tool installs
- Reinstall tools whose upgrade may have broken flags
- Avoid wrappers that exit non-zero in non-interactive shells
- Log stderr of failing commands to spot license/prompt failures
When it happens
Trigger: Calling `RunCommandWithEnv` on an executable that exists but exits non-zero: the tool crashes, a required arg is wrong for that tool version, a license/telemetry prompt fails in a non-interactive context, or the shim resolves to a broken install.
Common situations: Removed or renamed flags (e.g. `--version` unsupported on some binary); node/python version managers printing errors; corrupted toolchain after an OS upgrade; running the prompt inside an environment where the tool needs env vars that aren't set (command.envs incomplete).
Related errors
- err parsing info from %s with %s
- cannot parse version string
- NO VERSION
- no version found
- no valid terraform files found
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/1f4d8bcab6934e46.
Report an issue: GitHub.