{"record":{"id":"4289a0280983c8d6","repo":"affaan-m/ECC","slug":"requires-alpha-must-be-boolean","errorCode":null,"errorMessage":"requires_alpha must be boolean","messagePattern":"requires_alpha must be boolean","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/resolve.py","lineNumber":121,"sourceCode":"        frames = _integer(event.get(\"frames\"), \"frames\", 1)\n        opacity = event.get(\"opacity\")\n        if (\n            isinstance(opacity, bool)\n            or not isinstance(opacity, (int, float))\n            or not math.isfinite(opacity)\n            or not 0 <= opacity <= 100\n        ):\n            raise ValueError(\"explicit opacity must be finite within 0..100\")\n        composite = _integer(event.get(\"composite\"), \"composite\")\n        raw_asset = event.get(\"asset\")\n        if not isinstance(raw_asset, (str, Path)) or not str(raw_asset):\n            raise ValueError(\"asset must be a local regular file\")\n        asset = Path(raw_asset).expanduser().resolve()\n        if not asset.is_file():\n            raise ValueError(f\"asset must be a local regular file: {asset}\")\n        alpha = event.get(\"requires_alpha\", False)\n        if not isinstance(alpha, bool):\n            raise ValueError(\"requires_alpha must be boolean\")\n        key = str(asset)\n        if key not in metadata:\n            metadata[key] = probe(asset)\n        info = metadata[key]\n        if _fps(info.get(\"fps\")) != rate:\n            raise ValueError(f\"asset fps differs from timeline: {asset}\")\n        if _integer(info.get(\"frames\"), \"asset frames\", 1) < frames:\n            raise ValueError(f\"asset contains too few frames: {asset}\")\n        if alpha and info.get(\"has_alpha\") is not True:\n            raise ValueError(f\"asset requires verified alpha: {asset}\")\n        checked.append(\n            {\n                \"id\": identifier,\n                \"asset\": key,\n                \"record_frame\": start,\n                \"frames\": frames,\n                \"opacity\": opacity,\n                \"composite\": composite,","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/resolve.py#L103-L139","documentation":"Each event's 'requires_alpha' must be a real boolean (default False); allocate_placements raises ValueError('requires_alpha must be boolean') for anything else. Truthy ints like 1/0 are rejected because the library distinguishes 'not specified' from 'specified as false' and needs strict bools.","triggerScenarios":"Passing requires_alpha=1, 0, 'true'/'false' strings, None, or a JSON/YAML config that encodes the flag as a string or integer instead of a boolean.","commonSituations":"YAML configs quoting the flag ('true' → str); JSON APIs returning 0/1 from a database; shell-exported env flags parsed as strings and passed through; template systems inserting 'yes'/'no'.","solutions":["Pass Python booleans: requires_alpha=True or False (or omit the key for the default)","Convert string/int flags at load time: `ra = flag in (True, 'true', 'yes', 1)` then pass bool(ra)","If loading JSON from an API, coerce with `bool(event['requires_alpha'])` only after confirming it's a 0/1 or bool, else fix the producer","Fix config producers to emit real booleans (unquoted YAML true/false, JSON true/false)"],"exampleFix":"// before\n{\"id\": \"bug\", \"requires_alpha\": \"true\"}\n// after\n{\"id\": \"bug\", \"requires_alpha\": true}","handlingStrategy":"type-guard","validationCode":"def coerce_bool_flag(v, default=False):\n    if v is None:\n        return default\n    if isinstance(v, bool):\n        return v\n    if isinstance(v, str):\n        if v.lower() in ('true', 'yes', '1'):\n            return True\n        if v.lower() in ('false', 'no', '0'):\n            return False\n    raise ValueError(f'requires_alpha must be boolean, got {v!r}')\n\nfor ev in placements:\n    ev['requires_alpha'] = coerce_bool_flag(ev.get('requires_alpha'))","typeGuard":"def is_strict_bool(v) -> bool:\n    return isinstance(v, bool)","tryCatchPattern":"try:\n    resolve.allocate_placements(fps, count, placements)\nexcept ValueError as e:\n    if 'requires_alpha' in str(e):\n        raise PlacementError('requires_alpha must be a strict boolean') from e\n    raise","preventionTips":["Emit unquoted booleans in YAML (true, not 'true')","Coerce 0/1 DB flags to bools at the API boundary","Never pass env-var strings straight into boolean flags"],"tags":["validation","type-mismatch","boolean"],"backgroundTag":"type-mismatch","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}