{"record":{"id":"43d495acf6c19c67","repo":"calesthio/OpenMontage","slug":"res-status-url","errorCode":null,"errorMessage":"${res.status} ${url}","messagePattern":"\\$\\{res\\.status\\} \\$\\{url\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"backlot/ui/lib.js","lineNumber":5,"sourceCode":"// Shared helpers for the Backlot UI.\n\nexport async function getJSON(url) {\n  const res = await fetch(url);\n  if (!res.ok) throw new Error(`${res.status} ${url}`);\n  return res.json();\n}\n\nexport function el(tag, attrs = {}, ...children) {\n  const node = document.createElement(tag);\n  for (const [k, v] of Object.entries(attrs)) {\n    if (v == null) continue;\n    if (k === \"class\") node.className = v;\n    else if (k.startsWith(\"on\")) node.addEventListener(k.slice(2), v);\n    else node.setAttribute(k, v);\n  }\n  for (const child of children.flat()) {\n    if (child == null) continue;\n    node.append(child.nodeType ? child : document.createTextNode(String(child)));\n  }\n  return node;\n}\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/backlot/ui/lib.js#L1-L23","documentation":"Thrown by SeedanceArkTool._normalize_duration when the duration input is a Python bool. Because bool is a subclass of int in Python, the tool explicitly rejects True/False before the int conversion, treating a boolean as an invalid duration type. Valid inputs are the string \"auto\" (mapped to -1), -1, or an integer from 4 to max_seconds (default 15).","triggerScenarios":"Calling the seedance_ark tool with duration=true or duration=false (e.g. from JSON tool input where a toggle/flag value was wired into the duration field, or a template variable that evaluates to a boolean).","commonSituations":"LLM tool-call arguments generated with a boolean where a number was intended; config files reusing a feature-flag key as duration; YAML/JSON coercion turning 'on'/'off' into true/false.","solutions":["Pass an integer between 4 and 15, or -1, or the string \"auto\" for duration.","If the value comes from user input or an LLM, sanitize booleans to None before the call and let the default apply.","Check the code path that produces the duration argument for a boolean-returning expression (e.g. `duration: use_default` style flags)."],"exampleFix":"// before\n{\"duration\": true}\n// after\n{\"duration\": \"auto\"}","handlingStrategy":"type-guard","validationCode":"def ok_duration(v):\n    return v == \"auto\" or v == -1 or (isinstance(v, int) and not isinstance(v, bool) and 4 <= v <= 15)","typeGuard":"def is_valid_duration(v) -> bool:\n    if isinstance(v, bool):\n        return False\n    if v == \"auto\" or v == -1:\n        return True\n    return isinstance(v, int) and 4 <= v <= 15 or (isinstance(v, str) and v.strip().lstrip('-').isdigit() and (int(v) == -1 or 4 <= int(v) <= 15))","tryCatchPattern":"try:\n    result = tool.run(inputs)\nexcept ValueError as e:\n    if \"duration must be\" in str(e):\n        inputs[\"duration\"] = \"auto\"\n        result = tool.run(inputs)\n    else:\n        raise","preventionTips":["Never let boolean flags flow into the duration field; map them to \"auto\" explicitly.","Validate duration at the API/schema layer (JSON schema type: integer/enum) before it reaches the tool."],"tags":["python","validation","duration","seedance","type-confusion"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}