anthropics/skills · warning · ValueError

relationship target resolves to nothing: {target!r}

Error message

relationship target resolves to nothing: {target!r}

What it means

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.

Source

Thrown at skills/xlsx/scripts/office/helpers/__init__.py:54

    if target.startswith("/"):
        joined = target.lstrip("/")
    else:
        joined = posixpath.join(posixpath.dirname(source_part), target)

    parts: list[str] = []
    for segment in posixpath.normpath(joined).split("/"):
        if segment in ("", "."):
            continue
        if segment == "..":
            if not parts:
                raise ValueError(f"relationship target escapes the package: {target!r}")
            parts.pop()
        else:
            parts.append(segment)

    if not parts:
        raise ValueError(f"relationship target resolves to nothing: {target!r}")
    return "/".join(parts)


def rels_source_part(rels_file: Path, unpacked_dir: Path) -> str:
    owner_dir = rels_file.parent.parent.relative_to(unpacked_dir)
    return posixpath.join(owner_dir.as_posix(), rels_file.name[: -len(".rels")]).lstrip("./")


def part_text(data: bytes) -> str:
    return data.decode("utf-8", "surrogateescape")


XML_SPACE = " \t\r\n"


def rendered_text(text: str, preserve: bool) -> str:
    return text if preserve else text.strip(XML_SPACE)

View on GitHub (pinned to f6656c1256)

Solutions

  1. Find the entry: unzip and grep the .rels for Target="." or targets made only of dots/slashes
  2. Remove the useless relationship element entirely — a part-name target of '.' is never valid OPC
  3. Regenerate the file from the source tool once its template/placeholder bug is fixed
Defensive patterns

Strategy: validation

Validate before calling

def target_is_meaningful(target: str) -> bool:
    import posixpath
    return posixpath.normpath(target).strip("./") != ""

Try / catch

try:
    part = opc_target(target, source_part, mode)
except ValueError as e:
    if "resolves to nothing" in str(e):
        return None  # skip degenerate relationship, keep processing the rest
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14). Data as JSON: /api/errors/869b17350ef84791. Report an issue: GitHub.