{"record":{"id":"869b17350ef84791","repo":"anthropics/skills","slug":"relationship-target-resolves-to-nothing-target-r-869b17","errorCode":null,"errorMessage":"relationship target resolves to nothing: {target!r}","messagePattern":"relationship target resolves to nothing: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"skills/xlsx/scripts/office/helpers/__init__.py","lineNumber":54,"sourceCode":"\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:\n        raise ValueError(f\"relationship target resolves to nothing: {target!r}\")\n    return \"/\".join(parts)\n\n\ndef rels_source_part(rels_file: Path, unpacked_dir: Path) -> str:\n    owner_dir = rels_file.parent.parent.relative_to(unpacked_dir)\n    return posixpath.join(owner_dir.as_posix(), rels_file.name[: -len(\".rels\")]).lstrip(\"./\")\n\n\ndef part_text(data: bytes) -> str:\n    return data.decode(\"utf-8\", \"surrogateescape\")\n\n\nXML_SPACE = \" \\t\\r\\n\"\n\n\ndef rendered_text(text: str, preserve: bool) -> str:\n    return text if preserve else text.strip(XML_SPACE)\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/anthropics/skills/blob/f6656c1256d5a8adfa37db9110046ef20bac644c/skills/xlsx/scripts/office/helpers/__init__.py#L36-L72","documentation":"opc_target() succeeded in parsing the target but after normalization nothing remains — every segment was '', '.' or cancelled out — so there is no part name to return. Targets like '.', './', or 'a/../' (relative to the source part) produce this.","triggerScenarios":"A .rels entry with Target=\".\" or Target=\"\"-adjacent values (empty is filtered earlier, but '.' is not); a target like 'sheet1.xml/../' that normalizes to nothing; relationships whose target equals the source directory itself.","commonSituations":"Degenerate relationship entries written by broken exporters; template files where a relationship placeholder was never filled in; manual .rels editing that leaves a stub target.","solutions":["Find the entry: unzip and grep the .rels for Target=\".\" or targets made only of dots/slashes","Remove the useless relationship element entirely — a part-name target of '.' is never valid OPC","Regenerate the file from the source tool once its template/placeholder bug is fixed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def target_is_meaningful(target: str) -> bool:\n    import posixpath\n    return posixpath.normpath(target).strip(\"./\") != \"\"","typeGuard":null,"tryCatchPattern":"try:\n    part = opc_target(target, source_part, mode)\nexcept ValueError as e:\n    if \"resolves to nothing\" in str(e):\n        return None  # skip degenerate relationship, keep processing the rest\n    raise","preventionTips":["When authoring .rels, never emit a Target of '.', './' or self-cancelling paths","Validate generated relationships with opc_target itself in unit tests","Skip-and-log degenerate entries rather than aborting a whole batch job for one bad rel"],"tags":["ooxml","rels","validation","malformed"],"backgroundTag":null,"analyzedSha":"f6656c1256d5a8adfa37db9110046ef20bac644c","analyzedAt":"2026-08-14T16:09:17.493Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}