{"record":{"id":"cec816189e7fb21a","repo":"abhigyanpatwari/GitNexus","slug":"candidate-overlay-path-exceeds-max-candidate-path","errorCode":null,"errorMessage":"candidate overlay path exceeds {MAX_CANDIDATE_PATH_BYTES} bytes: {relative}","messagePattern":"candidate overlay path exceeds (.+?) bytes: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/evolution.py","lineNumber":300,"sourceCode":"    entries: list[Path] = []\n    pending = [overlay]\n    entry_count = 0\n    while pending:\n        directory = pending.pop()\n        child_directories: list[Path] = []\n        try:\n            iterator = os.scandir(directory)\n        except OSError as exc:\n            raise ValueError(f\"candidate overlay directory is unreadable: {directory}: {exc}\") from exc\n        with iterator:\n            for item in iterator:\n                entry_count += 1\n                if entry_count > MAX_CANDIDATE_ENTRIES:\n                    raise ValueError(f\"candidate overlay exceeds the {MAX_CANDIDATE_ENTRIES}-entry limit\")\n                path = Path(item.path)\n                relative = path.relative_to(overlay)\n                if len(relative.as_posix().encode()) > MAX_CANDIDATE_PATH_BYTES:\n                    raise ValueError(f\"candidate overlay path exceeds {MAX_CANDIDATE_PATH_BYTES} bytes: {relative}\")\n                if item.is_symlink():\n                    raise ValueError(f\"candidate overlay cannot contain symlinks: {relative}\")\n                if item.is_dir(follow_symlinks=False):\n                    child_directories.append(path)\n                    continue\n                if not item.is_file(follow_symlinks=False):\n                    raise ValueError(f\"candidate overlay entries must be regular files: {relative}\")\n                entries.append(path)\n                if len(entries) > MAX_CANDIDATE_FILES:\n                    raise ValueError(f\"candidate overlay exceeds the {MAX_CANDIDATE_FILES}-file limit\")\n        pending.extend(child_directories)\n\n    entries.sort(key=lambda path: path.relative_to(overlay).as_posix())\n    if not entries:\n        raise ValueError(f\"candidate overlay contains no files: {overlay}\")\n\n    for path in entries:\n        relative = path.relative_to(overlay)","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/evolution.py#L282-L318","documentation":"Thrown by candidate_overlay_files (evolution.py:300) when a single file's POSIX-relative path, UTF-8 encoded, exceeds MAX_CANDIDATE_PATH_BYTES (512 bytes). This bounds per-path memory and path-based attack surface; an excessively deep or long-named file is rejected during the walk.","triggerScenarios":"An overlay file with an extremely long name or a very deep directory chain whose relative POSIX path exceeds 512 bytes when encoded.","commonSituations":"Auto-generated/hashed filenames; deeply nested directory structures; a script that embeds long descriptions into paths.","solutions":["Shorten the filename and/or flatten the directory structure under .claude/skills/gitnexus-{plan,work}/.","Rename machine-generated long paths to concise human-readable ones.","Verify len(rel.as_posix().encode()) <= 512 before submitting."],"exampleFix":"# before: deeply nested long-named file\n.claude/skills/gitnexus-work/<512+ byte path>/SKILL.md\n\n# after: flatten and rename\nfrom pathlib import PurePosixPath\nrel = PurePosixPath('.claude/skills/gitnexus-work/SKILL.md')\nassert len(rel.as_posix().encode()) <= 512, 'path too long'","handlingStrategy":"validation","validationCode":"from pathlib import PurePosixPath\nfrom workflow_bench.evolution import MAX_CANDIDATE_PATH_BYTES\n\ndef paths_within_byte_limit(root):\n    from pathlib import Path\n    ok = True\n    for p in Path(root).rglob('*'):\n        rel = PurePosixPath(p.relative_to(root).as_posix())\n        if len(rel.as_posix().encode()) > MAX_CANDIDATE_PATH_BYTES:\n            ok = False\n    return ok","typeGuard":"null","tryCatchPattern":"try:\n    apply_candidate_overlay(overlay, worktree, sandbox=sandbox)\nexcept ValueError as exc:\n    if 'path exceeds' in str(exc):\n        # shorten/flatten the named path, then retry\n        ...","preventionTips":["Use short, human-readable filenames in the overlay.","Avoid deeply nested directory chains under the skill root.","Pre-check len(rel.encode()) <= 512 (MAX_CANDIDATE_PATH_BYTES)."],"tags":["size-limit","path","overlay"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}