{"record":{"id":"3815d5c4dbdd65b0","repo":"babalae/better-genshin-impact","slug":"main-js-file-not-found","errorCode":null,"errorMessage":"main js file not found.","messagePattern":"main js file not found\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/Script/Project/Manifest.cs","lineNumber":56,"sourceCode":"    {\n        if (string.IsNullOrWhiteSpace(Name))\n        {\n            throw new Exception(\"manifest.json: name is required.\");\n        }\n\n        if (string.IsNullOrWhiteSpace(Version))\n        {\n            throw new Exception(\"manifest.json: version is required.\");\n        }\n\n        if (string.IsNullOrWhiteSpace(Main))\n        {\n            throw new Exception(\"manifest.json: main script is required.\");\n        }\n\n        if (!File.Exists(Path.Combine(path, Main)))\n        {\n            throw new FileNotFoundException(\"main js file not found.\");\n        }\n\n        // 比较版本号大小 BgiVersion\n        if (!string.IsNullOrWhiteSpace(BgiVersion) && Global.IsNewVersion(BgiVersion))\n        {\n            TaskControl.Logger.LogError(\"脚本 {Name} 版本号要求 {BgiVersion} 大于当前 BetterGI 版本号 {CurrentVersion} ， 脚本可能无法正常工作，请更新 BetterGI 版本！\", Name, BgiVersion, Global.Version);\n        }\n    }\n\n    public List<SettingItem> LoadSettingItems(string path)\n    {\n        if (string.IsNullOrWhiteSpace(SettingsUi))\n        {\n            return [];\n        }\n\n        var settingItems = new List<SettingItem>();\n        var settingFile = Path.Combine(path, SettingsUi);","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/Script/Project/Manifest.cs#L38-L74","documentation":"Thrown by Manifest.Validate when the main JS file specified in manifest.json does not exist on disk at Path.Combine(path, Main). This is a FileNotFoundException — the manifest passed all field validation but the referenced entry-point file is missing from the project directory.","triggerScenarios":"Manifest.Validate(path) is called after deserialization. The Main field is non-empty (passed the previous check), but File.Exists(Path.Combine(projectPath, main)) returns false. The main JS file was deleted, renamed, or the path is wrong.","commonSituations":"The main.js file was accidentally deleted or renamed. The manifest's 'main' field points to the wrong filename (typo, wrong extension, wrong path). A script package was incompletely extracted/downloaded. Case-sensitivity mismatch on Linux (Main.js vs main.js).","solutions":["Check that the file specified in manifest.json's 'main' field exists in the script folder.","Verify the filename spelling, case, and extension match exactly.","If the file was renamed, update manifest.json's 'main' field to match.","Re-download or re-extract the script package if files are missing."],"exampleFix":"// manifest.json: \"main\": \"index.js\" but file is main.js\n// before\n\"main\": \"index.js\"\n// after\n\"main\": \"main.js\"","handlingStrategy":"validation","validationCode":"var mainFile = Path.Combine(projectPath, manifest.Main);\nif (!File.Exists(mainFile))\n    throw new FileNotFoundException($\"Main JS file not found: {mainFile}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    manifest.Validate(projectPath);\n}\ncatch (FileNotFoundException ex) when (ex.Message.Contains(\"main js file not found\"))\n{\n    TaskControl.Logger.LogError(\"Entry-point JS file missing for script\");\n}","preventionTips":["Verify the main JS file exists after creating or downloading a script package.","Check filename case sensitivity, especially on Linux.","Ensure the 'main' field in manifest.json exactly matches the file on disk."],"tags":["manifest","file-not-found","script-project","validation"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}