{"record":{"id":"cfa0b5cc31b5eccc","repo":"JanDeDobbeleer/oh-my-posh","slug":"empty-m-editorversion","errorCode":null,"errorMessage":"empty m_EditorVersion","messagePattern":"empty m_EditorVersion","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/segments/unity.go","lineNumber":76,"sourceCode":"\n\tif !u.env.HasFilesInDir(projectDir.Path, \"ProjectVersion.txt\") {\n\t\tlog.Debug(\"no ProjectVersion.txt file found\")\n\t\treturn \"\", err\n\t}\n\n\tversionFilePath := filepath.Join(projectDir.Path, \"ProjectVersion.txt\")\n\tversionFileText := u.env.FileContent(versionFilePath)\n\n\tlines := strings.SplitSeq(versionFileText, \"\\n\")\n\tversionPrefix := \"m_EditorVersion: \"\n\tfor line := range lines {\n\t\tif !strings.HasPrefix(line, versionPrefix) {\n\t\t\tcontinue\n\t\t}\n\t\tversion := strings.TrimPrefix(line, versionPrefix)\n\t\tversion = strings.TrimSpace(version)\n\t\tif version == \"\" {\n\t\t\treturn \"\", errors.New(\"empty m_EditorVersion\")\n\t\t}\n\t\tfIndex := strings.Index(version, \"f\")\n\t\tif fIndex > 0 {\n\t\t\treturn version[:fIndex], nil\n\t\t}\n\t\treturn version, nil\n\t}\n\n\treturn \"\", errors.New(\"ProjectSettings/ProjectVersion.txt is missing m_EditorVersion\")\n}\n\nconst (\n\tcsharp6  = \"C# 6\"\n\tcsharp73 = \"C# 7.3\"\n\tcsharp8  = \"C# 8\"\n\tcsharp9  = \"C# 9\"\n)\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/unity.go#L58-L94","documentation":"The unity segment reads ProjectSettings/ProjectVersion.txt to report the Unity editor version. GetUnityVersion parses lines looking for the m_EditorVersion prefix; if the prefixed line exists but the remainder is empty after trimming, it throws 'empty m_EditorVersion'. The file exists and has the key but no value.","triggerScenarios":"Enabled calls GetUnityVersion while in a Unity project directory and ProjectSettings/ProjectVersion.txt contains a line starting with `m_EditorVersion:` (or the configured prefix) whose value is empty or only whitespace — typically a truncated or interrupted project serialization.","commonSituations":"Unity crashed or was killed mid-write leaving an incomplete ProjectVersion.txt; the file was hand-edited or diff-merged badly; a git LFS checkout produced an empty value; working in a partially initialized project folder.","solutions":["Open the project in Unity (or run it) so ProjectVersion.txt is rewritten correctly","Restore ProjectVersion.txt from version control (git checkout -- ProjectSettings/ProjectVersion.txt)","Manually set the value, e.g. `m_EditorVersion: 2022.3.10f1`","Disable the unity segment when not inside a valid Unity project"],"exampleFix":"// before: ProjectSettings/ProjectVersion.txt\nm_EditorVersion:\n// after\nm_EditorVersion: 2022.3.10f1","handlingStrategy":"validation","validationCode":"// before parsing, validate the file content\ndata, err := os.ReadFile(\"ProjectSettings/ProjectVersion.txt\")\nvalid := err == nil && strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(string(data)), \"m_EditorVersion:\")) != \"\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't hand-edit ProjectVersion.txt; let Unity own it","Commit a valid ProjectVersion.txt so checkouts are never blank","Disable the unity segment outside real Unity project roots"],"tags":["unity","segment","file-parsing","go"],"backgroundTag":"empty-required-field","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}