affaan-m/ECC · error · ValueError

local_only must be an exact boolean

Error message

local_only must be an exact boolean

What it means

build_application_bundle's local_only is a keyword-only flag that must be a strict Python bool (checked with type(...) is not bool, rejecting truthy values like 1 or 'true'). The strict check prevents ambiguous mode switching between local preservation and hosted provider compilation.

Solutions

  1. Pass a real boolean: build_application_bundle(cfg, ci, local_only=True)
  2. Coerce before calling: local_only = bool(value) only after verifying value in (True, False)
  3. Fix the bundle file so 'local_only' is JSON true/false, not 1/0 or "true"
  4. In validate_application_bundle inputs, ensure the serialized bundle stores a proper boolean

Example fix

// before
build_application_bundle(cfg, ci, local_only="true")
// after
build_application_bundle(cfg, ci, local_only=True)
Defensive patterns

Strategy: type-guard

Validate before calling

if not isinstance(local_only, bool):
    raise TypeError("local_only must be a strict bool")

Type guard

def is_strict_bool(v):
    return type(v) is bool

Try / catch

try:
    bundle = build_application_bundle(cfg, ci, local_only=local_only)
except ValueError as e:
    if "exact boolean" in str(e):
        local_only = (str(local_only).lower() == "true")
        bundle = build_application_bundle(cfg, ci, local_only=local_only)
    else:
        raise

Prevention

When it happens

Trigger: Passing local_only=1, 0, 'true', None, or any non-bool to build_application_bundle or callers that forward it (validate_application_bundle reads it from the bundle dict via bundle.get('local_only', False), so a bundle storing local_only: 1 also trips this).

Common situations: Deserializing bundles from JSON/YAML where booleans survived as 1/0 or strings; CLI shims forwarding argparse values as strings; JavaScript-generated configs using true/false incorrectly mapped.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

        if (item["retime"] != "none" or target[1] - target[0] != source[1] - source[0]
                or _rate(candidate["fps"]) != _rate(config["baseline"]["fps"])):
            raise ValueError("candidate fps/duration/retime ambiguity")
        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"]):

View on GitHub (pinned to 8321021c54)