{"record":{"id":"37a236b16deb0950","repo":"CoplayDev/unity-mcp","slug":"expected-file-not-found-f","errorCode":null,"errorMessage":"Expected file not found: {f}","messagePattern":"Expected file not found: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/prepare_unity_asset_store_release.py","lineNumber":139,"sourceCode":"        print(\"[dry-run] Would stage a temporary copy of MCPForUnity and apply Asset Store edits there.\")\n        print(\n            f\"[dry-run] Would replace:\\n- {dest_mcp}\\n  with\\n- {source_mcp}\")\n        return 0\n\n    # 1) Stage a temporary copy of MCPForUnity and apply Asset Store-specific edits there.\n    with tempfile.TemporaryDirectory(prefix=\"mcpforunity_assetstore_\") as tmpdir:\n        staged_mcp = Path(tmpdir) / \"MCPForUnity\"\n        shutil.copytree(source_mcp, staged_mcp)\n\n        setup_service = staged_mcp / \"Editor\" / \"Setup\" / \"SetupWindowService.cs\"\n        menu_file = staged_mcp / \"Editor\" / \"MenuItems\" / \"MCPForUnityMenu.cs\"\n        http_util = staged_mcp / \"Editor\" / \"Helpers\" / \"HttpEndpointUtility.cs\"\n        connection_section = staged_mcp / \"Editor\" / \"Windows\" / \\\n            \"Components\" / \"Connection\" / \"McpConnectionSection.cs\"\n\n        for f in (setup_service, menu_file, http_util, connection_section):\n            if not f.is_file():\n                raise RuntimeError(f\"Expected file not found: {f}\")\n\n        # Remove auto-popup setup window for Asset Store packaging\n        remove_line_exact(setup_service, \"[InitializeOnLoad]\")\n\n        # Set default remote base URL to the hosted endpoint\n        replace_once(\n            http_util,\n            r'private const string DefaultRemoteBaseUrl = \"\";',\n            f'private const string DefaultRemoteBaseUrl = \"{remote_url}\";',\n        )\n\n        # Default transport to HTTP Remote and persist inferred scope when missing\n        replace_once(\n            connection_section,\n            r'transportDropdown\\.Init\\(TransportProtocol\\.HTTPLocal\\);',\n            'transportDropdown.Init(TransportProtocol.HTTPRemote);',\n        )\n        replace_once(","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/tools/prepare_unity_asset_store_release.py#L121-L157","documentation":"Raised inside the temporary staging directory after copying MCPForUnity: one of four hardcoded files (SetupWindowService.cs, MCPForUnityMenu.cs, HttpEndpointUtility.cs, McpConnectionSection.cs) is missing from the staged copy. This is a structural-integrity guard — the release script applies string replacements to these files, so they must exist at the expected relative paths.","triggerScenarios":"Any of the four files was renamed, moved, or deleted in a repo restructure. The script copies the live MCPForUnity tree, so the staged copy mirrors the current source layout. If Editor/Setup/SetupWindowService.cs, Editor/MenuItems/MCPForUnityMenu.cs, Editor/Helpers/HttpEndpointUtility.cs, or Editor/Windows/Components/Connection/McpConnectionSection.cs no longer sits at that exact path, the loop raises.","commonSituations":"A refactoring PR reorganized the Editor/ folder hierarchy; a file was split or merged; the script was written against an older layout than the current branch.","solutions":["Check the error path in the message — it names the specific missing file.","Locate the file's current path in MCPForUnity/Editor/ and update the corresponding variable in the script (setup_service, menu_file, http_util, or connection_section).","If the file was removed entirely, determine whether the corresponding source edit is still needed and remove that edit step."],"exampleFix":"# before\nsetup_service = staged_mcp / \"Editor\" / \"Setup\" / \"SetupWindowService.cs\"\n\n# after — updated after the file moved during refactor\nsetup_service = staged_mcp / \"Editor\" / \"Windows\" / \"Setup\" / \"SetupWindowService.cs\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nexpected_files = [\n    \"Editor/Setup/SetupWindowService.cs\",\n    \"Editor/MenuItems/MCPForUnityMenu.cs\",\n    \"Editor/Helpers/HttpEndpointUtility.cs\",\n    \"Editor/Windows/Components/Connection/McpConnectionSection.cs\",\n]\nsource_mcp = Path(\"MCPForUnity\").resolve()\nmissing = [f for f in expected_files if not (source_mcp / f).is_file()]\nif missing:\n    raise SystemExit(f\"Missing expected files in MCPForUnity: {missing}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run --dry-run first to validate paths before staging and editing.","When restructuring MCPForUnity/Editor/, update the hardcoded paths in this script in the same PR.","Add a CI check that runs the release script in dry-run mode to catch path drift early."],"tags":["build-script","release-tooling","path-validation","source-edit","filesystem"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}