{"record":{"id":"929c0a9baad49b86","repo":"ATH-MaaS/Pixelle-Video","slug":"str-e-929c0a","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/resources.py","lineNumber":76,"sourceCode":"    }\n    ```\n    \"\"\"\n    try:\n        # Get all workflows from TTS service\n        all_workflows = pixelle_video.tts.list_workflows()\n        \n        # Filter to TTS workflows only (filename starts with \"tts_\")\n        tts_workflows = [\n            WorkflowInfo(**wf) \n            for wf in all_workflows \n            if wf[\"name\"].startswith(\"tts_\")\n        ]\n        \n        return WorkflowListResponse(workflows=tts_workflows)\n        \n    except Exception as e:\n        logger.error(f\"List TTS workflows error: {e}\")\n        raise HTTPException(status_code=500, detail=str(e))\n\n\n@router.get(\"/workflows/media\", response_model=WorkflowListResponse)\nasync def list_media_workflows(pixelle_video: PixelleVideoDep):\n    \"\"\"\n    List available media workflows (both image and video)\n    \n    Returns list of all media workflows from both RunningHub and self-hosted sources.\n    \n    Example response:\n    ```json\n    {\n        \"workflows\": [\n            {\n                \"name\": \"image_flux.json\",\n                \"display_name\": \"image_flux.json - Runninghub\",\n                \"source\": \"runninghub\",\n                \"path\": \"workflows/runninghub/image_flux.json\",","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/api/routers/resources.py#L58-L94","documentation":"GET /workflows/tts catches any exception raised while enumerating available TTS workflows and returns HTTP 500 with str(e). It means the workflow discovery/scan step failed — typically the workflow directory is missing or unreadable, or the video service dependency is unavailable — not that the request was malformed.","triggerScenarios":"GET /workflows/tts when the underlying PixelleVideoDep service or workflow-directory scan throws (missing workflows dir, permission error, backend not initialized).","commonSituations":"Deployment missing the workflows directory or mounted at the wrong path; backend media service not started; file permissions broken after container image change.","solutions":["Check server logs for 'List TTS workflows error:' for the root cause","Verify the workflows directory exists and contains TTS workflow files","Ensure the media/video backend service the dependency requires is running","Fix filesystem permissions on the workflows directory","Server-side: sanitize detail instead of returning str(e)"],"exampleFix":"// before\nexcept Exception as e:\n    logger.error(f\"List TTS workflows error: {e}\")\n    raise HTTPException(status_code=500, detail=str(e))\n// after\nexcept Exception:\n    logger.exception(\"List TTS workflows error\")\n    raise HTTPException(status_code=500, detail=\"Unable to list TTS workflows\")","handlingStrategy":"fallback","validationCode":"// check listing health before relying on it\nconst res = await fetch('/workflows/tts');\nif (!res.ok) {\n  console.warn('TTS workflow listing unavailable, using cached list');\n  return cachedTtsWorkflows;\n}","typeGuard":"function isWorkflowList(r) { return Array.isArray(r?.workflows) && r.workflows.every(w => typeof w.id === 'string'); }","tryCatchPattern":"try {\n  const res = await fetch('/workflows/tts');\n  if (!res.ok) throw new Error(`listing failed: ${res.status}`);\n  return (await res.json()).workflows;\n} catch (err) {\n  return cachedWorkflowList ?? []; // serve stale list rather than failing the UI\n}","preventionTips":["Cache the workflow list from a successful call and reuse it on failure","For self-hosters: verify the workflows directory is present in your deployment","Ensure the media backend service is started before the API","Alert on 5xx from resource-listing endpoints — they indicate deployment issues, not client bugs"],"tags":["http-500","workflow-discovery","fastapi","filesystem"],"backgroundTag":"internal-server-error-500","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}