{"record":{"id":"e86d09b392a893cb","repo":"JanDeDobbeleer/oh-my-posh","slug":"no-version-found","errorCode":null,"errorMessage":"no version found","messagePattern":"no version found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/segments/language.go","lineNumber":468,"sourceCode":"\t\t}\n\n\t\t// Success only: a failed run (a non-CommandError err, or one the\n\t\t// caller above already turned into an early return) never gets\n\t\t// cached, so a transient failure cannot pin a bad result for a week.\n\t\tif err == nil && cacheable {\n\t\t\tcache.Device.Set(cacheKey, versionStr, cache.ONEWEEK)\n\t\t}\n\n\t\treturn versionStr, nil\n\t}\n\n\tversionStr, err := command.getVersion()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif versionStr == \"\" {\n\t\treturn \"\", errors.New(\"no version found\")\n\t}\n\n\treturn versionStr, nil\n}\n\n// versionCacheKey reports the device-cache key for command's raw output, and\n// whether command is eligible for that cache at all. Eligibility requires:\n// opting in via versionCacheable, an environment that can resolve a real\n// executable identity (DataOnly cannot), and a resolvable, statable\n// executable path.\n//\n// The key mixes the resolved absolute path with the executable's mtime and\n// size, the exact arguments, and any extra environment the command runs\n// with, so a PATH change, a reinstalled or upgraded binary, different args,\n// or different envs all produce a different key and therefore a cache miss -\n// invalidation follows from what the output depends on, not from a guessed\n// TTL. The TTL passed to cache.Set (see runCommand) exists only so a device\n// cache nobody prunes doesn't grow forever; it plays no part in correctness.","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/language.go#L450-L486","documentation":"For language commands that provide a custom getVersion function, runCommand() returns 'no version found' when that function succeeds but returns an empty string. This means the version could not be extracted from the tool even though no explicit error occurred.","triggerScenarios":"A custom getVersion implementation (used by specific language segments that need bespoke output handling) returns empty output with nil error — e.g. the underlying command produced nothing on stdout or a custom display command yields no version text.","commonSituations":"Tool installed but emits its version on stderr or nothing at all; custom display_mode commands in the theme return empty output; a broken tool installation silently printing nothing.","solutions":["Run the segment's version command manually and confirm it prints a version string to stdout.","Reinstall or repair the language tool if it prints nothing.","Adjust the segment's display command/args so the version is printed on stdout.","Check for shell profiles or wrappers that suppress command output."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"out=$(<tool> --version 2>/dev/null); [ -n \"$out\" ] || echo 'tool prints no version on stdout'","typeGuard":null,"tryCatchPattern":"versionStr, err := command.getVersion()\nif err != nil || versionStr == \"\" {\n    // skip this command / hide segment\n}","preventionTips":["Confirm the tool prints its version to stdout, not stderr.","Reinstall tools that print nothing for --version.","Test custom display commands with `oh-my-posh debug`."],"tags":["version-parsing","empty-output","language-segment"],"backgroundTag":"empty-command-output","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}