JanDeDobbeleer/oh-my-posh · warning

ProjectSettings/ProjectVersion.txt is missing m_EditorVersio

Error message

ProjectSettings/ProjectVersion.txt is missing m_EditorVersion

What it means

GetUnityVersion scans the whole ProjectSettings/ProjectVersion.txt for a line starting with m_EditorVersion and falls through to this error when no such line is found at all. Unlike the empty-value case, the key is entirely missing, so no version could be extracted.

Source

Thrown at src/segments/unity.go:85

	lines := strings.SplitSeq(versionFileText, "\n")
	versionPrefix := "m_EditorVersion: "
	for line := range lines {
		if !strings.HasPrefix(line, versionPrefix) {
			continue
		}
		version := strings.TrimPrefix(line, versionPrefix)
		version = strings.TrimSpace(version)
		if version == "" {
			return "", errors.New("empty m_EditorVersion")
		}
		fIndex := strings.Index(version, "f")
		if fIndex > 0 {
			return version[:fIndex], nil
		}
		return version, nil
	}

	return "", errors.New("ProjectSettings/ProjectVersion.txt is missing m_EditorVersion")
}

const (
	csharp6  = "C# 6"
	csharp73 = "C# 7.3"
	csharp8  = "C# 8"
	csharp9  = "C# 9"
)

func (u *Unity) GetCSharpVersion() (version string, err error) {
	shortUnityVersion, _, found := strings.CutLast(u.UnityVersion, ".")
	if !found {
		return "", errors.New("lastDotIndex")
	}

	var csharpVersionsByUnityVersion = map[string]string{
		"2017.1": csharp6,
		"2017.2": csharp6,

View on GitHub (pinned to 0976794618)

Solutions

  1. Verify you are in the Unity project root that contains a populated ProjectSettings/ProjectVersion.txt
  2. Restore the file from version control or regenerate it by opening the project in Unity
  3. Manually add `m_EditorVersion: <version>` to ProjectSettings/ProjectVersion.txt
  4. Disable the unity segment outside real Unity projects

Example fix

// before: ProjectVersion.txt missing key
ProjectVersion: 2022.3.10f1
// after
m_EditorVersion: 2022.3.10f1
Defensive patterns

Strategy: validation

Validate before calling

// verify the key exists before enabling the segment
data, _ := os.ReadFile("ProjectSettings/ProjectVersion.txt")
hasKey := strings.Contains(string(data), "m_EditorVersion")

Prevention

When it happens

Trigger: Enabled calls GetUnityVersion in a directory where ProjectSettings/ProjectVersion.txt exists but contains no `m_EditorVersion:` line — an empty file, an unrelated file, or a file whose keys were renamed.

Common situations: Empty placeholder ProjectVersion.txt in a stub/scaffolded directory; Unity version upgraded to a format the reader doesn't expect; checking out a repo where the file was committed blank; being in a lookalike folder with only some Unity settings files.

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/ab2d2f004a2f05c8. Report an issue: GitHub.