affaan-m/ECC · error · ContractError
contains a boolean numeric value
Error message
{label} contains a boolean numeric value What it means
_validate_numeric_evidence rejects boolean values used where numbers are expected. In Python, bool is a subclass of int, so True would silently pass numeric checks; this explicit check prevents booleans from posing as numeric evidence in probe documents.
Solutions
- Replace boolean values in numeric fields with actual numbers (1/0) in the source document.
- If the field is genuinely a flag, move it outside the numeric-evidence structure.
- Author YAML with explicit numbers (duration: 1) and quote values that must stay strings/bools.
- Add a pre-save lint that rejects bools inside numeric evidence sections.
Example fix
// before "duration": true // after "duration": 1
Defensive patterns
Strategy: type-guard
Validate before calling
def no_bools(node) -> bool:
if isinstance(node, bool): return False
if isinstance(node, dict): return all(no_bools(v) for v in node.values())
if isinstance(node, list): return all(no_bools(v) for v in node)
return True Type guard
def is_real_number(v) -> bool:
return isinstance(v, (int, float)) and not isinstance(v, bool) Try / catch
try:
validate_genre_specs(spec)
except ContractError as e:
if 'boolean numeric value' in str(e):
fix_bool_numerics(spec) # map True/False to 1/0 in numeric fields
else:
raise Prevention
- Never use true/false as placeholders for 1/0 in evidence fields
- Remember bool is a subclass of int in Python — always check bool first
- When authoring YAML, quote values that must not coerce to booleans
- Lint numeric-evidence sections for booleans before saving
When it happens
Trigger: validate_genre_specs or probe evidence containing numeric fields set to true/false — e.g. "duration": true, nested dicts/lists of evidence containing booleans. The function recurses into dicts and lists, so any nested bool triggers it.
Common situations: YAML-authored specs where yes/no become booleans, authors using true as a placeholder for 1, template documents with unfinished boolean toggles inside numeric blocks.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- application bundle differs from its bound evidence
- At least one video is required
- cannot upload, file does not exist
- Draft name must be a plain file name
- Geometry, fps and duration must be finite and positive
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/a999d1862a3ae56e.
Report an issue: GitHub.
Appendix: source
Thrown at skills/taste-application/scripts/tasteforge/contract.py:39
def _is_finite_real(value: Any) -> bool:
return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value)
def _validate_media_time(value: Any, source_duration: Any, *, label: str) -> None:
if not _is_finite_real(source_duration):
raise ContractError(f"{label} has an invalid finite source duration")
source_duration = cast(float, source_duration)
if float(source_duration) <= 0:
raise ContractError(f"{label} has an invalid finite source duration")
if (not _is_finite_real(value) or float(value) < 0
or float(value) > float(source_duration)):
raise ContractError(f"{label} is outside its source duration")
def _validate_numeric_evidence(value: Any, *, label: str) -> None:
if isinstance(value, bool):
raise ContractError(f"{label} contains a boolean numeric value")
if isinstance(value, (int, float)):
if not math.isfinite(value):
raise ContractError(f"{label} contains a non-finite numeric value")
elif isinstance(value, dict):
for nested in value.values():
_validate_numeric_evidence(nested, label=label)
elif isinstance(value, list):
for nested in value:
_validate_numeric_evidence(nested, label=label)
def _validate_probe_evidence(probe: Any, source_duration: float, *, label: str) -> None:
if not isinstance(probe, dict):
raise ContractError(f"{label} lacks probe evidence")
_validate_numeric_evidence(probe, label=label)
if probe.get("duration") != source_duration:
raise ContractError(f"{label} probe duration is not bound to source duration")
for field in ("sample_times", "scene_changes"):View on GitHub (pinned to 8321021c54)