{"record":{"id":"dfaf4cfff6e3d4e4","repo":"warpdotdev/warp","slug":"config-too-large","errorCode":"config_too_large","errorMessage":"config_too_large","messagePattern":"config_too_large","errorType":"exception","errorClass":"MergeError","httpStatus":null,"severity":"error","filePath":"resources/bundled/skills/tui-migrate-setup/scripts/merge_mcp_config.py","lineNumber":118,"sourceCode":"        document.update(value)\n\n\ndef _read_regular_file(path: Path, *, missing_ok: bool) -> tuple[bytes, int | None]:\n    try:\n        metadata = path.lstat()\n    except FileNotFoundError:\n        if missing_ok:\n            return b\"\", None\n        raise MergeError(\"source_config_unavailable\")\n    except OSError as error:\n        raise MergeError(\"config_unavailable\") from error\n\n    if stat.S_ISLNK(metadata.st_mode):\n        raise MergeError(\"config_symlink_rejected\")\n    if not stat.S_ISREG(metadata.st_mode):\n        raise MergeError(\"config_not_regular_file\")\n    if metadata.st_size > MAX_CONFIG_BYTES:\n        raise MergeError(\"config_too_large\")\n\n    flags = os.O_RDONLY\n    if hasattr(os, \"O_NOFOLLOW\"):\n        flags |= os.O_NOFOLLOW\n    try:\n        descriptor = os.open(path, flags)\n        with os.fdopen(descriptor, \"rb\") as file:\n            raw = file.read(MAX_CONFIG_BYTES + 1)\n    except OSError as error:\n        raise MergeError(\"config_unavailable\") from error\n    if len(raw) > MAX_CONFIG_BYTES:\n        raise MergeError(\"config_too_large\")\n    return raw, stat.S_IMODE(metadata.st_mode)\n\n\ndef _decode_document(raw: bytes) -> dict[str, Any]:\n    try:\n        document = json.loads(raw.decode(\"utf-8\"))","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/resources/bundled/skills/tui-migrate-setup/scripts/merge_mcp_config.py#L100-L136","documentation":"Hard size cap enforced before reading: MAX_CONFIG_BYTES is 8 MiB (8*1024*1024, defined at the top of merge_mcp_config.py); if lstat reports st_size above it, config_too_large is raised without reading a byte. Real MCP configs are a few KB, so an oversized 'config' almost always means the wrong file or runaway growth.","triggerScenarios":"Passing a large JSON (export, log, data dump) as --source/--destination; a config bloated by embedded blobs such as gallery_data or template payloads; concatenated duplicate dumps.","commonSituations":"Wrong path to a big JSON in the same directory; tools appending history into the config; pasting a full export into the config file.","solutions":["Verify you passed the config file, not a neighboring export/log — check with ls -lh","Inspect what is big (python -m json.tool FILE | less) and strip embedded data blobs that do not belong in an MCP config","If there is genuinely >8 MiB of server definitions, split into multiple configs — the cap is a deliberate safety limit, not a tunable"],"exampleFix":"# before\npython merge_mcp_config.py --source ~/Downloads/export-with-history.json ...  # 40 MB\n# error: config_too_large\n\n# after\npython merge_mcp_config.py --source ~/.claude.json ...  # the actual few-KB config","handlingStrategy":"validation","validationCode":"import os\n\nMAX_CONFIG_BYTES = 8 * 1024 * 1024\nfor p in (source_path, destination_path):\n    if os.path.exists(p) and os.lstat(p).st_size > MAX_CONFIG_BYTES:\n        raise SystemExit(f'{p} exceeds the 8 MiB cap — wrong file?')","typeGuard":null,"tryCatchPattern":"if result.returncode != 0 and 'config_too_large' in result.stderr:\n    # ls -lh both paths; verify they are the actual configs, not exports/logs\n    ...","preventionTips":["Keep MCP configs free of embedded data blobs (gallery_data, template dumps)","Check file size before running the merge","Split oversized legitimate configs rather than fighting the cap"],"tags":["filesystem","size-limit","config"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}