{"record":{"id":"2d9a0c38b2bbcb6c","repo":"mudler/LocalAI","slug":"audio-is-required-for-longcat-video-avatar-1-5","errorCode":null,"errorMessage":"audio is required for LongCat-Video-Avatar-1.5","messagePattern":"audio is required for LongCat-Video-Avatar-1\\.5","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/python/longcat-video/backend.py","lineNumber":611,"sourceCode":"        else:\n            width, height = validate_dimensions(request.width, request.height)\n            output = self.pipeline.generate_t2v(\n                prompt=request.prompt,\n                negative_prompt=negative_prompt,\n                height=height,\n                width=width,\n                num_frames=frames,\n                num_inference_steps=steps,\n                use_distill=use_distill,\n                guidance_scale=guidance_scale,\n                generator=generator,\n            )[0]\n\n        self._save_video(output, request.dst, fps)\n\n    def _generate_avatar(self, request, params, context):\n        if not request.audio:\n            raise ValueError(\"audio is required for LongCat-Video-Avatar-1.5\")\n        if not os.path.isfile(request.audio):\n            raise ValueError(\"audio input is not a readable staged file\")\n\n        use_distill = self.options[\"use_distill\"]\n        steps = (\n            8\n            if use_distill\n            else require_int(\n                request.step or 50,\n                \"step\",\n                minimum=1,\n                maximum=200,\n            )\n        )\n        text_guidance = (\n            1.0\n            if use_distill\n            else require_float(","sourceCodeStart":593,"sourceCodeEnd":629,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/python/longcat-video/backend.py#L593-L629","documentation":"ValueError from _generate_avatar(): LongCat-Video-Avatar-1.5 is an audio-driven avatar model — every generation request must carry an audio file. An empty/absent request.audio is rejected immediately (a follow-up check also requires the file to exist on disk). Maps to gRPC INVALID_ARGUMENT.","triggerScenarios":"Sending a VideoRequest with no audio field to a backend whose loaded model is Avatar-1.5; clearing audio but keeping prompt-only usage like the base model.","commonSituations":"Using one client code path for both base and avatar models; assuming prompt-only generation works on the avatar variant.","solutions":["Attach a staged audio file path via request.audio for every avatar generation","If you want text/image-to-video without audio, load the LongCat-Video base model instead"],"exampleFix":"# before (avatar model loaded)\nreq = backend_pb2.VideoRequest(prompt=\"a sunset\", dst=out_path)\n\n# after\nreq = backend_pb2.VideoRequest(prompt=\"a sunset\", dst=out_path, audio=\"/data/staged/voice.wav\")","handlingStrategy":"validation","validationCode":"def build_avatar_request(prompt: str, audio_path: str, dst: str):\n    if not audio_path:\n        raise ValueError(\"avatar generation requires an audio file\")\n    return backend_pb2.VideoRequest(prompt=prompt, audio=audio_path, dst=dst)","typeGuard":null,"tryCatchPattern":"try:\n    stub.GenerateVideo(req)\nexcept grpc.RpcError as e:\n    if \"audio is required\" in (e.details() or \"\"):\n        raise UserError(\"Provide a voice track for avatar generation\") from e\n    raise","preventionTips":["Enforce required fields per model kind in the request builder","Integration-test each model kind with its minimal valid request"],"tags":["python","longcat-video","grpc","audio","validation"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}