{"record":{"id":"3f1744c12cb68a52","repo":"affaan-m/ECC","slug":"application-config-exceeds-local-size-limit","errorCode":null,"errorMessage":"application config exceeds local size limit","messagePattern":"application config exceeds local size limit","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/integration.py","lineNumber":344,"sourceCode":"        evidence = _artifact(item[\"approval_file\"], parse_json=True)\n        expected = {\"status\": \"approved\", \"candidate_sha256\": candidate[\"media\"][\"sha256\"],\n                    \"source_sha256\": config[\"source\"][\"media\"][\"sha256\"],\n                    \"compiled_input_sha256\": input_hash,\n                    \"edit_context_sha256\": edit_hash,\n                    \"candidate_range\": source, \"timeline_range\": target}\n        if not isinstance(evidence, dict) or any(\n                _canonical(evidence.get(key)) != _canonical(value) for key, value in expected.items()):\n            raise ValueError(\"approval evidence must bind exact source, candidate and placement\")\n        occupied.append(target)\n\n\ndef build_application_bundle(config: dict, compiled_input: dict | None, *, local_only: bool = False) -> dict:\n    \"\"\"Validate resident evidence and return a new deterministic, offline bundle.\"\"\"\n    if type(local_only) is not bool:\n        raise ValueError(\"local_only must be an exact boolean\")\n    _object(config, _REQUIRED, _OPTIONAL)\n    if len(_canonical(config)) > _MAX_JSON:\n        raise ValueError(\"application config exceeds local size limit\")\n    if local_only:\n        if compiled_input is not None:\n            raise ValueError(\"local-only preservation cannot accept provider input\")\n    else:\n        _object(compiled_input, {\"source_video\", \"compiled_prompt\"})\n        url = urlsplit(_text(compiled_input[\"source_video\"]))\n        if url.scheme != \"https\" or not url.hostname or url.username or url.password:\n            raise ValueError(\"source reference must be HTTPS without embedded credentials\")\n        _text(compiled_input[\"compiled_prompt\"])\n    cfg = copy.deepcopy(config)\n    for key in (\"audio\", \"candidates\", \"inserts\", \"historical_receipts\"):\n        cfg.setdefault(key, [])\n        if not isinstance(cfg[key], list):\n            raise ValueError(\"bundle collections must be lists\")\n    if local_only and (cfg[\"candidates\"] or cfg[\"inserts\"]):\n        raise ValueError(\"local-only preservation cannot contain candidates or inserts\")\n    tracks = _snapshot(cfg[\"baseline\"])\n    _binding(cfg[\"source\"], tracks, cfg[\"baseline\"])","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/integration.py#L326-L362","documentation":"The application config passed to build_application_bundle is canonicalized to JSON and must stay under the module's _MAX_JSON size limit. Oversized configs are rejected so the deterministic bundle builder and validator stay within predictable local resource bounds.","triggerScenarios":"Calling build_application_bundle (directly or via validate_application_bundle/main) with a config dict whose canonical JSON serialization exceeds _MAX_JSON bytes — typically after embedding large payloads in audio items, candidates, inserts, historical_receipts, or extra config fields.","commonSituations":"Embedding base64 media thumbnails or full receipt blobs in the config instead of file references; accumulating historical receipts until the config grows past the limit; accidentally passing the whole project file as config.","solutions":["Trim the config to required keys only; move bulky data to external files referenced by path/hash","Drop or archive old entries in historical_receipts, candidates, or inserts before rebuilding","Increase available headroom by canonicalizing (no duplicate/whitespace-heavy fields) — note the limit itself is fixed in code, so reduce data, not the cap","Split one large application into multiple smaller bundles"],"exampleFix":"# before\nconfig[\"historical_receipts\"].extend(all_500_receipts)  # huge\n# after\nconfig[\"historical_receipts\"] = all_500_receipts[-20:]  # keep only recent, reference the rest externally","handlingStrategy":"validation","validationCode":"import json\ndef config_within_limit(cfg, limit):\n    return len(json.dumps(cfg, sort_keys=True, separators=(\",\", \":\"))) <= limit","typeGuard":null,"tryCatchPattern":"try:\n    bundle = build_application_bundle(cfg, ci)\nexcept ValueError as e:\n    if \"exceeds local size limit\" in str(e):\n        cfg = slim_config(cfg)  # move bulky data to external references\n        bundle = build_application_bundle(cfg, ci)\n    else:\n        raise","preventionTips":["Reference media/receipts by hash+path instead of embedding them","Prune historical_receipts periodically","Keep configs minimal: required keys plus concise lists","Monitor canonical config size in CI before bundling"],"tags":["validation","size-limit","config"],"backgroundTag":"payload-too-large","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}