PaddlePaddle/PaddleOCR · error · SystemExit
Could not resolve exported file (wanted {wanted_out_name!r},
Error message
Could not resolve exported file (wanted {wanted_out_name!r}, stored {stored_name!r}). What it means
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.
Source
Thrown at deploy/ios_demo/scripts/extract_xcresult_attachments.py:289
str(result_path),
"--test-id",
test_identifier,
"--output-path",
td,
]
)
if r.returncode != 0:
raise SystemExit(
_die(
f"xcresulttool export attachments failed with exit {r.returncode}.",
f"test-id={test_identifier}",
"Inspect stderr above.",
)
)
td_path = Path(td)
src = _pick_exported_file(td_path, wanted_out_name, stored_name)
if src is None or not src.is_file():
raise SystemExit(
_die(
f"Could not resolve exported file (wanted {wanted_out_name!r}, stored {stored_name!r}).",
f"export dir: {td}",
"Check `manifest.json` and `xcresulttool export attachments` stderr.",
)
)
out_path.parent.mkdir(parents=True, exist_ok=True)
shutil.move(str(src), str(out_path))
def main(argv: List[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--result", required=True, type=Path, help="Path to .xcresult bundle."
)
parser.add_argument(
"--output-dir",
required=True,View on GitHub (pinned to 2661c7c0ef)
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.
Example fix
// before
parser.add_argument("--name", default="ocr_result")
# attachment actually titled "OCR Result" in the test:
# XCTAttachment(name: "OCR Result")
// after
XCTAttachment(name: "ocr_result") // keep attachment title identical to --name
# or pass the exact stored name:
python extract_xcresult_attachments.py ... --name "OCR Result" Defensive patterns
Strategy: validation
Validate before calling
import json
from pathlib import Path
def name_in_manifest(export_dir: Path, wanted: str) -> bool:
manifest = export_dir / "manifest.json"
if not manifest.is_file():
return False
data = json.loads(manifest.read_text())
names = [a.get("exportedFileName", "") for a in data]
return any(wanted == n or n.startswith(Path(wanted).stem + "_") for n in names) Try / catch
try:
extract(...)
except SystemExit:
# the failing export dir is printed; keep it and diff manifest.json against --name
log.error("check printed export dir manifest.json vs requested --name")
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- xcresulttool export attachments failed with exit {r.returnco
- Could not parse xcresulttool JSON: {e}.
- xcresulttool metrics export failed
- degenerate text crop (zero width/height)
- compare_ocr_json.py requires `pip install shapely`
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/5e1a64b13cc1f781.
Report an issue: GitHub.