affaan-m/ECC · error · ValueError

missing required bundle fields

Error message

missing required bundle fields

What it means

_object validates that a value is a dict containing at least the required keys; if the value is not a dict or is missing any required key it raises ValueError('missing required bundle fields'). It is the shared structural validator for all bundle sub-objects (rate, artifact, snapshot, binding, etc.).

Solutions

  1. Diff the offending object's keys against the required set in the corresponding validator (_snapshot, _binding, etc.) and add the missing field
  2. Regenerate the bundle with the current version of build_application_bundle instead of hand-editing
  3. Add a pre-flight check that each section contains the required keys before calling validate

Example fix

// before
snapshot = {"fps": {"numerator": 24, "denominator": 1}}
// after
snapshot = {"fps": {"numerator": 24, "denominator": 1}, "duration_frames": 240}
Defensive patterns

Strategy: validation

Validate before calling

REQUIRED_SNAPSHOT = {"fps", "duration_frames"}
missing = REQUIRED_SNAPSHOT - snapshot.keys()
assert not missing, f"snapshot missing fields: {missing}"

Type guard

def has_required(obj, required: set) -> bool:
    return isinstance(obj, dict) and required <= obj.keys()

Try / catch

try:
    bundle = validate_application_bundle(raw)
except ValueError as e:
    if "missing required bundle fields" in str(e):
        print("bundle schema mismatch; regenerate with build_application_bundle")
    else:
        raise

Prevention

When it happens

Trigger: Any bundle section passed to build_application_bundle/validate_application_bundle missing a required key, e.g. a snapshot without 'fps' or 'duration_frames', or a binding missing 'source_range'.

Common situations: Hand-written bundle JSON missing a field, older bundles produced by a previous schema version, or typos in key names ('framerate' vs 'fps').

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

_REQUIRED = {"baseline", "source", "audio", "protected_intervals"}
_OPTIONAL = {"candidates", "inserts", "historical_receipts"}
_MAX_JSON = 8 * 1024 * 1024


def _canonical(value: Any) -> bytes:
    try:
        return json.dumps(value, sort_keys=True, separators=(",", ":"), allow_nan=False).encode()
    except (TypeError, ValueError, RecursionError) as exc:
        raise ValueError("bundle values must be finite JSON data") from exc


def _digest(value: Any) -> str:
    return hashlib.sha256(_canonical(value)).hexdigest()


def _object(value: Any, required: set[str], optional: set[str] | None = None) -> dict:
    if not isinstance(value, dict) or not required <= value.keys():
        raise ValueError("missing required bundle fields")
    if value.keys() - required - (optional or set()):
        raise ValueError("unknown bundle fields")
    return value


def _text(value: Any) -> str:
    if not isinstance(value, str) or not value.strip():
        raise ValueError("nonempty text required")
    return value


def _integer(value: Any, minimum: int = 0) -> int:
    if type(value) is not int or value < minimum:
        raise ValueError("frame/count must be an exact integer in range")
    return value


def _rate(value: Any) -> tuple[int, int]:

View on GitHub (pinned to 8321021c54)