affaan-m/ECC · error · ValueError

application config exceeds local size limit

Error message

application config exceeds local size limit

What it means

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.

Solutions

  1. Trim the config to required keys only; move bulky data to external files referenced by path/hash
  2. Drop or archive old entries in historical_receipts, candidates, or inserts before rebuilding
  3. Increase available headroom by canonicalizing (no duplicate/whitespace-heavy fields) — note the limit itself is fixed in code, so reduce data, not the cap
  4. Split one large application into multiple smaller bundles

Example fix

# before
config["historical_receipts"].extend(all_500_receipts)  # huge
# after
config["historical_receipts"] = all_500_receipts[-20:]  # keep only recent, reference the rest externally
Defensive patterns

Strategy: validation

Validate before calling

import json
def config_within_limit(cfg, limit):
    return len(json.dumps(cfg, sort_keys=True, separators=(",", ":"))) <= limit

Try / catch

try:
    bundle = build_application_bundle(cfg, ci)
except ValueError as e:
    if "exceeds local size limit" in str(e):
        cfg = slim_config(cfg)  # move bulky data to external references
        bundle = build_application_bundle(cfg, ci)
    else:
        raise

Prevention

When it happens

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

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

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/3f1744c12cb68a52. Report an issue: GitHub.

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/integration.py:344

        evidence = _artifact(item["approval_file"], parse_json=True)
        expected = {"status": "approved", "candidate_sha256": candidate["media"]["sha256"],
                    "source_sha256": config["source"]["media"]["sha256"],
                    "compiled_input_sha256": input_hash,
                    "edit_context_sha256": edit_hash,
                    "candidate_range": source, "timeline_range": target}
        if not isinstance(evidence, dict) or any(
                _canonical(evidence.get(key)) != _canonical(value) for key, value in expected.items()):
            raise ValueError("approval evidence must bind exact source, candidate and placement")
        occupied.append(target)


def build_application_bundle(config: dict, compiled_input: dict | None, *, local_only: bool = False) -> dict:
    """Validate resident evidence and return a new deterministic, offline bundle."""
    if type(local_only) is not bool:
        raise ValueError("local_only must be an exact boolean")
    _object(config, _REQUIRED, _OPTIONAL)
    if len(_canonical(config)) > _MAX_JSON:
        raise ValueError("application config exceeds local size limit")
    if local_only:
        if compiled_input is not None:
            raise ValueError("local-only preservation cannot accept provider input")
    else:
        _object(compiled_input, {"source_video", "compiled_prompt"})
        url = urlsplit(_text(compiled_input["source_video"]))
        if url.scheme != "https" or not url.hostname or url.username or url.password:
            raise ValueError("source reference must be HTTPS without embedded credentials")
        _text(compiled_input["compiled_prompt"])
    cfg = copy.deepcopy(config)
    for key in ("audio", "candidates", "inserts", "historical_receipts"):
        cfg.setdefault(key, [])
        if not isinstance(cfg[key], list):
            raise ValueError("bundle collections must be lists")
    if local_only and (cfg["candidates"] or cfg["inserts"]):
        raise ValueError("local-only preservation cannot contain candidates or inserts")
    tracks = _snapshot(cfg["baseline"])
    _binding(cfg["source"], tracks, cfg["baseline"])

View on GitHub (pinned to 8321021c54)