{"record":{"id":"5e1a64b13cc1f781","repo":"PaddlePaddle/PaddleOCR","slug":"could-not-resolve-exported-file-wanted-wanted-ou","errorCode":null,"errorMessage":"Could not resolve exported file (wanted {wanted_out_name!r}, stored {stored_name!r}).","messagePattern":"Could not resolve exported file \\(wanted (.+?), stored (.+?)\\)\\.","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"deploy/ios_demo/scripts/extract_xcresult_attachments.py","lineNumber":289,"sourceCode":"                str(result_path),\n                \"--test-id\",\n                test_identifier,\n                \"--output-path\",\n                td,\n            ]\n        )\n        if r.returncode != 0:\n            raise SystemExit(\n                _die(\n                    f\"xcresulttool export attachments failed with exit {r.returncode}.\",\n                    f\"test-id={test_identifier}\",\n                    \"Inspect stderr above.\",\n                )\n            )\n        td_path = Path(td)\n        src = _pick_exported_file(td_path, wanted_out_name, stored_name)\n        if src is None or not src.is_file():\n            raise SystemExit(\n                _die(\n                    f\"Could not resolve exported file (wanted {wanted_out_name!r}, stored {stored_name!r}).\",\n                    f\"export dir: {td}\",\n                    \"Check `manifest.json` and `xcresulttool export attachments` stderr.\",\n                )\n            )\n        out_path.parent.mkdir(parents=True, exist_ok=True)\n        shutil.move(str(src), str(out_path))\n\n\ndef main(argv: List[str] | None = None) -> int:\n    parser = argparse.ArgumentParser(description=__doc__)\n    parser.add_argument(\n        \"--result\", required=True, type=Path, help=\"Path to .xcresult bundle.\"\n    )\n    parser.add_argument(\n        \"--output-dir\",\n        required=True,","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/deploy/ios_demo/scripts/extract_xcresult_attachments.py#L271-L307","documentation":"Raised as SystemExit after a successful `xcresulttool export attachments` when the exported file cannot be located. The script resolves the on-disk filename via manifest.json entries (exportedFileName / suggestedHumanReadableName) matched against the wanted attachment name; if _pick_exported_file returns None or a path that is not a regular file, it aborts.","triggerScenarios":"The attachment's logical name (from the activities tree) does not match any manifest.json entry — e.g. tests name attachments with characters the manifest sanitizes differently; the export dir is empty because the test wrote no attachment payload; the stored name heuristic (stem + underscore suffix) does not fit your naming scheme.","commonSituations":"Attachment titles with spaces, slashes, or unicode normalized differently between activities and manifest; duplicated attachment names within one test; Xcode versions that omit exportedFileName from the manifest.","solutions":["Open the printed export dir (kept on failure) and read manifest.json to see the actual exported filenames and adjust the --name you pass.","Adjust _matches_wanted_attachment / _pick_exported_file heuristics if your tests title attachments differently (the module docstring explicitly calls this a repo heuristic).","Confirm the test actually attached a payload (activities tree shows a payloadId); a name with no payload exports nothing.","Regenerate the .xcresult on a current Xcode if the manifest lacks exportedFileName fields."],"exampleFix":"// before\nparser.add_argument(\"--name\", default=\"ocr_result\")\n# attachment actually titled \"OCR Result\" in the test:\n# XCTAttachment(name: \"OCR Result\")\n\n// after\nXCTAttachment(name: \"ocr_result\")  // keep attachment title identical to --name\n# or pass the exact stored name:\npython extract_xcresult_attachments.py ... --name \"OCR Result\"","handlingStrategy":"validation","validationCode":"import json\nfrom pathlib import Path\n\ndef name_in_manifest(export_dir: Path, wanted: str) -> bool:\n    manifest = export_dir / \"manifest.json\"\n    if not manifest.is_file():\n        return False\n    data = json.loads(manifest.read_text())\n    names = [a.get(\"exportedFileName\", \"\") for a in data]\n    return any(wanted == n or n.startswith(Path(wanted).stem + \"_\") for n in names)","typeGuard":null,"tryCatchPattern":"try:\n    extract(...)\nexcept SystemExit:\n    # the failing export dir is printed; keep it and diff manifest.json against --name\n    log.error(\"check printed export dir manifest.json vs requested --name\")\n    raise","preventionTips":["Keep XCTAttachment names byte-identical to the --name argument (avoid spaces/unicode).","Treat the name-matching logic as a project heuristic — extend _matches_wanted_attachment when test naming changes.","Run the extractor once on a sample bundle after any Xcode upgrade."],"tags":["ios","xcresult","attachments","manifest","cli"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}