affaan-m/ECC · error · ValueError
reference probe numeric evidence must be finite real values
Error message
reference probe numeric evidence must be finite real values
What it means
validate_probe (via its require_finite_evidence closure in _validate_probe) walks the entire probe result dict and rejects any numeric leaf that is not a finite real number: NaN, +/-inf, or a bool (booleans are explicitly rejected so 'truthy' flags cannot masquerade as measurements). The probe contract requires that every numeric value in the measured evidence is a genuine finite float/int, because these values feed fingerprints, prompts, and timeline math.
Solutions
- Fix the probe callable to return only finite int/float measurements — remove boolean fields or convert them to numeric encodings.
- Guard divisions in the probe (frame rate, duration) against zero denominators and fall back to a finite sentinel or raise your own clear error.
- Sanitize the probe output: recursively replace NaN/inf with valid numbers or drop those keys before returning.
- If using ffprobe, handle 'N/A'/'0/0' rate strings explicitly instead of letting float() propagate NaN/inf.
- For mock probes in tests, generate payloads that satisfy the finite-number contract (no bools, no nan/inf).
Example fix
// before
probe = lambda p: {"duration": 5.0, "has_audio": True, "fps": float('inf')}
run_workflow("contract.json", "out/", probe=probe)
// after
probe = lambda p: {"duration": 5.0, "audio_channels": 2, "fps": 0.0}
run_workflow("contract.json", "out/", probe=probe) Defensive patterns
Strategy: type-guard
Validate before calling
import math
def probe_payload_is_clean(measured: dict) -> bool:
def walk(v):
if isinstance(v, bool) or v is None:
return False
if isinstance(v, (int, float)):
return math.isfinite(v)
if isinstance(v, dict):
return all(walk(x) for x in v.values())
if isinstance(v, list):
return all(walk(x) for x in v)
return True
return isinstance(measured, dict) and walk(measured)
# before run_workflow(..., probe=my_probe)
assert probe_payload_is_clean(my_probe(path)), "probe returned bool/non-finite evidence" Type guard
def is_finite_real(v) -> bool:
return isinstance(v, (int, float)) and not isinstance(v, bool) and math.isfinite(v) Try / catch
try:
receipt = run_workflow("contract.json", "out/", probe=my_probe)
except ValueError as e:
if "finite real values" in str(e):
logger.error("probe emitted bool/NaN/inf: sanitize or fix the probe callable")
receipt = run_workflow("contract.json", "out/", probe=sanitize(my_probe))
else:
raise Prevention
- Never return booleans from a probe; encode flags numerically or omit them
- Run every probe output through an isfinite check before returning it
- Guard all divisions in probe math against zero denominators
- Keep test doubles/probe stubs aligned with the finite-number contract
When it happens
Trigger: run_workflow() -> _stable_probe(path, probe) -> _validate_probe(measured) when the injected probe callable (the `probe` argument to run_workflow, or probe_media) returns a dict containing a bool value (e.g. "ok": True), or a NaN/Infinity from a division like 0/0 fps or float('inf') duration.
Common situations: A custom probe stub returning JSON-ish mock data that includes booleans; probe math dividing by zero frame duration producing inf; ffprobe-like sources returning 'N/A' parsed via float() into nan; test doubles returning None inside nested lists that later coerce badly.
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
- genre has invalid total duration
- reference probe duration must be finite and positive
- scores must be finite and between 0 and 1
- -32602
- a claim token is required
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/c47f5408ecfc09d0.
Report an issue: GitHub.
Appendix: source
Thrown at skills/taste-application/scripts/tasteforge/workflow.py:129
try:
rebound_stat = os.fstat(rebound)
if (rebound_stat.st_dev, rebound_stat.st_ino) != (before.st_dev, before.st_ino):
raise ValueError("reference source identity changed during media probing")
finally:
os.close(rebound)
return measured, total, source_digest
finally:
os.close(descriptor)
def _finite_real(value: Any) -> bool:
return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value)
def _validate_probe(measured: dict[str, Any]) -> float:
def require_finite_evidence(value: Any) -> None:
if isinstance(value, bool):
raise ValueError( # noqa: TRY004 - one bounded invalid-media error family
"reference probe numeric evidence must be finite real values"
)
if isinstance(value, (int, float)):
if not math.isfinite(value):
raise ValueError("reference probe numeric evidence must be finite real values")
elif isinstance(value, dict):
for nested in value.values():
require_finite_evidence(nested)
elif isinstance(value, list):
for nested in value:
require_finite_evidence(nested)
require_finite_evidence(measured)
duration = measured.get("duration")
if not _finite_real(duration):
raise ValueError("reference probe duration must be finite and positive")
duration = cast(float, duration)
if float(duration) <= 0:View on GitHub (pinned to 8321021c54)