{"record":{"id":"2f49bb7aa58d2db8","repo":"affaan-m/ECC","slug":"resolve-duration-must-be-finite-and-positive","errorCode":null,"errorMessage":"resolve_duration must be finite and positive","messagePattern":"resolve_duration must be finite and positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/workflow.py","lineNumber":440,"sourceCode":"    }[modality]\n    return base + suffix\n\n\ndef _build_effect_recipe(\n    config: dict[str, Any], specs: list[dict[str, Any]], references: list[dict[str, Any]]\n) -> dict[str, Any]:\n    \"\"\"Build a deterministic, seeded, non-periodic Resolve placement plan.\"\"\"\n    seed = int(config[\"seed\"])\n    rng = random.Random(seed)\n    by_genre = {\n        spec[\"number\"]: [ref for ref in references if ref[\"genre_number\"] == spec[\"number\"]]\n        for spec in specs\n    }\n    configured_duration = config.get(\"resolve_duration\")\n    if configured_duration is not None and (\n        not _finite_real(configured_duration) or float(configured_duration) <= 0\n    ):\n        raise ValueError(\"resolve_duration must be finite and positive\")\n    duration = float(configured_duration or sum(\n        spec[\"measured_features\"][\"total_duration\"] for spec in specs\n    ))\n    duration = max(duration, 6.0)\n    effect_names = {\n        \"flash-ethereal\": \"bloom_flash\",\n        \"3d-cyber-glitch\": \"cv_wireframe_lock\",\n        \"fluid-sketch\": \"fluid_contour_bleed\",\n    }\n    event_times: list[float] = []\n    clock = round(rng.uniform(0.35, 0.75), 6)\n    while clock <= duration - 0.08 and len(event_times) < 18:\n        event_times.append(clock)\n        clock = round(clock + rng.uniform(0.61, 2.17), 6)\n\n    # Short timelines use deterministic, aperiodic fallback positions rather\n    # than forcing later random draws beyond the declared duration.\n    if len(event_times) < 4:","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/workflow.py#L422-L458","documentation":"The effect recipe builder accepts an optional explicit resolve_duration from config. If provided, it must be a finite real number greater than zero; NaN, infinity, strings, negatives, and zero are rejected to keep timeline math well-defined.","triggerScenarios":"Config JSON contains resolve_duration set to 0, a negative number, a non-numeric value, null-like strings, NaN/Infinity, or a string like \"8.5\" that _finite_real rejects.","commonSituations":"Hand-edited YAML/JSON configs; copying a duration value with units (\"8s\"); templating bugs emitting empty strings; float formatting producing NaN.","solutions":["Set resolve_duration to a positive finite number (e.g. 8.5) in the config, or remove the key to auto-derive from measured source durations","Validate the config value with a quick check before running","Fix templating/serialization that emits strings or NaN instead of numbers"],"exampleFix":"// before\n\"resolve_duration\": \"8s\"\n// after\n\"resolve_duration\": 8.0","handlingStrategy":"validation","validationCode":"import math\nd = config.get(\"resolve_duration\")\nif d is not None:\n    assert isinstance(d, (int, float)) and not isinstance(d, bool) and math.isfinite(d) and d > 0, \\\n        \"resolve_duration must be a finite positive number\"","typeGuard":"def is_valid_duration(v) -> bool:\n    import math\n    return (isinstance(v, (int, float)) and not isinstance(v, bool)\n            and math.isfinite(v) and v > 0)","tryCatchPattern":"try:\n    run_workflow(config)\nexcept ValueError as e:\n    if \"resolve_duration\" in str(e):\n        config[\"resolve_duration\"] = None  # fall back to measured durations\n        run_workflow(config)\n    else:\n        raise","preventionTips":["Always emit durations as JSON numbers, never strings with units","Validate config with a schema (e.g. jsonschema) before running","Avoid templating that can inject empty strings or NaN"],"tags":["config","validation","duration"],"backgroundTag":"invalid-config-value","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"}