{"record":{"id":"90981bc9a82b4b36","repo":"anthropics/skills","slug":"relationship-target-is-not-a-posix-part-name-tar-90981b","errorCode":null,"errorMessage":"relationship target is not a POSIX part name: {target!r}","messagePattern":"relationship target is not a POSIX part name: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/pptx/scripts/office/helpers/__init__.py","lineNumber":35,"sourceCode":"}\n\n_SCHEME_RE = re.compile(r\"^[A-Za-z][A-Za-z0-9+.\\-]*:\")\n\nSLIDE_REL_TYPE = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide\"\n\n\ndef opc_target(target: str, source_part: str, target_mode: str = \"\") -> str | None:\n    if not target:\n        return None\n    if target_mode.lower() == \"external\":\n        return None\n    if _SCHEME_RE.match(target):\n        return None\n\n    target = urllib.parse.unquote(target)\n\n    if \"\\\\\" in target:\n        raise ValueError(f\"relationship target is not a POSIX part name: {target!r}\")\n\n    if target.startswith(\"/\"):\n        joined = target.lstrip(\"/\")\n    else:\n        joined = posixpath.join(posixpath.dirname(source_part), target)\n\n    parts: list[str] = []\n    for segment in posixpath.normpath(joined).split(\"/\"):\n        if segment in (\"\", \".\"):\n            continue\n        if segment == \"..\":\n            if not parts:\n                raise ValueError(f\"relationship target escapes the package: {target!r}\")\n            parts.pop()\n        else:\n            parts.append(segment)\n\n    if not parts:","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/anthropics/skills/blob/f6656c1256d5a8adfa37db9110046ef20bac644c/skills/pptx/scripts/office/helpers/__init__.py#L17-L53","documentation":"Identical guard to error 3, in the pptx copy of office/helpers: opc_target() converts a relationship Target into a POSIX OPC part name and rejects any target containing a backslash, since OPC part names are forward-slash only. A backslash indicates a Windows-style path written by a non-conformant producer; guessing a conversion could resolve to the wrong part.","triggerScenarios":"Processing a PPTX whose .rels files contain targets like \"..\\\\media\\\\image1.png\" — hit by thumbnail.py (get_slide_info reads ppt/_rels/presentation.xml.rels) and clean.py during referenced-file collection.","commonSituations":"Decks from third-party converters or report tools writing Windows paths; files round-tripped through zip tools on Windows; fuzzed/malformed inputs.","solutions":["Repair the .rels: replace backslashes with forward slashes in the Target attribute the message names.","Re-save the deck with PowerPoint/LibreOffice to rewrite relationships conformantly.","Pre-validate: scan all .rels targets for '\\\\' before invoking the pipeline and reject/repair such files.","Report the bug to the generator that produced the deck."],"exampleFix":"# repair step before processing\nimport re, pathlib\nfor rels in unpacked.rglob(\"*.rels\"):\n    p = pathlib.Path(rels)\n    p.write_text(p.read_text(encoding=\"utf-8\").replace(\"Target=\\\"..\\\\\\\\\", \"Target=\\\"../\"), encoding=\"utf-8\")","handlingStrategy":"validation","validationCode":"import zipfile, re\n\ndef rels_have_backslash_targets(path: str) -> bool:\n    with zipfile.ZipFile(path) as zf:\n        return any(\n            b\"\\\\\" in m.group(1)\n            for name in zf.namelist() if name.endswith(\".rels\")\n            for m in re.finditer(rb'Target=\"([^\"]*)\"', zf.read(name))\n        )","typeGuard":null,"tryCatchPattern":"try:\n    opc_target(target, source_part, target_mode)\nexcept ValueError as e:\n    if \"not a POSIX part name\" in str(e):\n        opc_target(target.replace(\"\\\\\", \"/\"), source_part, target_mode)  # logged repair\n    else:\n        raise","preventionTips":["Pre-scan pptx .rels targets for backslashes before processing.","Re-save non-conformant decks via LibreOffice/PowerPoint.","Log offending targets for upstream generator fixes."],"tags":["pptx","ooxml","opc","relationships","validation"],"backgroundTag":null,"analyzedSha":"f6656c1256d5a8adfa37db9110046ef20bac644c","analyzedAt":"2026-08-14T16:09:17.493Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}