{"record":{"id":"2d52fb764711bf23","repo":"abhigyanpatwari/GitNexus","slug":"dependency-symlink-target-exceeds-the-path-limit","errorCode":null,"errorMessage":"dependency symlink target exceeds the path limit: {relative}","messagePattern":"dependency symlink target exceeds the path limit: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/task_assets.py","lineNumber":476,"sourceCode":"            )\n        )\n\n    def _copy_symlink(\n        self,\n        parent_descriptor: int,\n        name: str,\n        relative: PurePosixPath,\n        before: os.stat_result,\n    ) -> None:\n        try:\n            target = os.readlink(name, dir_fd=parent_descriptor)\n            target_bytes = target.encode(\"utf-8\")\n        except (OSError, UnicodeEncodeError) as exc:\n            raise SandboxError(f\"dependency symlink is unreadable or not UTF-8: {relative}\") from exc\n        if not target or PurePosixPath(target).is_absolute() or \"\\x00\" in target:\n            raise SandboxError(f\"dependency symlink must be a bounded relative link: {relative}\")\n        if len(target_bytes) > MAX_TASK_ASSET_PATH_BYTES:\n            raise SandboxError(f\"dependency symlink target exceeds the path limit: {relative}\")\n        if self.budget.total_bytes + len(target_bytes) > MAX_TASK_ASSET_BYTES:\n            raise SandboxError(\"sandbox_copy exceeds the total byte limit\")\n        destination = self.destination / Path(*relative.parts)\n        os.symlink(target, destination)\n        after = os.stat(name, dir_fd=parent_descriptor, follow_symlinks=False)\n        if (\n            _mutation_identity(before) != _mutation_identity(after)\n            or os.readlink(\n                name,\n                dir_fd=parent_descriptor,\n            )\n            != target\n        ):\n            raise SandboxError(f\"dependency symlink changed while snapshotting: {relative}\")\n        self.total_bytes += len(target_bytes)\n        self.budget.total_bytes += len(target_bytes)\n        self._record(\n            AssetManifestEntry(","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/task_assets.py#L458-L494","documentation":"Raised by _copy_symlink when the symlink target, encoded as UTF-8 bytes, exceeds MAX_TASK_ASSET_PATH_BYTES (4096 bytes). This mirrors the path-length guard applied to manifest paths generally and keeps individual entries bounded so the manifest cannot be bloated by a single pathological link. It is a containment limit, not an expected-size assertion.","triggerScenarios":"A symlink whose target string is longer than 4096 bytes when UTF-8 encoded. Rare in practice; can occur with generated links whose target is a deeply nested or programmatically constructed path, or with malicious/corrupted link targets in a vendored dependency.","commonSituations":"A vendored package contains an absurdly long symlink target (generated by a buggy installer). A test fixture deliberately created an over-long link. Symlink targets that embed long base64 or URL strings.","solutions":["Locate the link: `find <dep-source> -type l -exec sh -c 't=$(readlink \"$1\"); [ ${#t} -gt 4096 ] && echo \"$1: ${#t} bytes\"' _ {} \\;`.","Recreate the link with a shorter relative target, or replace it with a directory if a long alias was being used to mirror a path.","Remove the offending link if it is not needed for the dependency to function.","Regenerate node_modules with a standard package manager rather than a custom linking script that produces long targets."],"exampleFix":"# before — link target over 4096 bytes\nln -s \"$(printf 'a%.0s' {1..5000})\" node_modules/.long\n\n# after\nrm node_modules/.long\nln -s ../real-package node_modules/.long","handlingStrategy":"validation","validationCode":"from pathlib import Path\nimport os\n\nMAX_PATH_BYTES = 4096\n\ndef validate_symlink_target_length(dep_source: Path) -> None:\n    for current, dirs, files in os.walk(dep_source, followlinks=False):\n        for name in dirs + files:\n            p = Path(current) / name\n            if p.is_symlink():\n                n = len(os.readlink(p).encode(\"utf-8\"))\n                if n > MAX_PATH_BYTES:\n                    raise ValueError(f\"symlink target too long ({n} bytes): {p}\")\n\nfor d in task.get(\"sandbox_dependencies\", []):\n    validate_symlink_target_length(repo_path / d[\"source\"])","typeGuard":"import os\nfrom pathlib import Path\n\ndef symlink_target_within_limit(p: Path, limit: int = 4096) -> bool:\n    try:\n        return len(os.readlink(p).encode(\"utf-8\")) <= limit\n    except (OSError, UnicodeEncodeError):\n        return False","tryCatchPattern":"from eval.workflow_bench.propposer_sandbox import SandboxError\n\ntry:\n    snapshot = cache.prepare(task, repo=repo, resolved_sha=sha)\nexcept SandboxError as exc:\n    if \"target exceeds the path limit\" in str(exc):\n        # shorten or remove the offending link, then re-run\n        raise\n    raise","preventionTips":["Avoid programmatically constructing symlink targets from long strings.","Reinstall dependencies cleanly if a corrupted long-link install is suspected.","Audit with `find <dep-source> -type l -exec sh -c 't=$(readlink \"$1\"); [ ${#t} -gt 4096 ] && echo \"$1\"' _ {} \\;`."],"tags":["sandbox","symlink","dependencies","limits","path-length"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}