{"record":{"id":"d3c977b3af14a4f8","repo":"xtekky/gpt4free","slug":"failed-to-find-any-videos-for-the-prompt","errorCode":null,"errorMessage":"Failed to find any videos for the prompt.","messagePattern":"Failed to find any videos for the prompt\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"g4f/Provider/needs_auth/Video.py","lineNumber":164,"sourceCode":"            raise ValueError(\n                f\"Model '{model}' is not supported by {cls.__name__}. Supported models: {cls.models}\"\n            )\n        yield ProviderInfo(**cls.get_dict(), model=model)\n        prompt = (\n            format_media_prompt(messages, prompt)\n            .encode()[:100]\n            .decode(\"utf-8\", \"ignore\")\n            .strip()\n        )\n        if not prompt:\n            raise ValueError(\"Prompt cannot be empty.\")\n        prompt = await RequestConfig.translate_prompt(prompt)\n        response = await RequestConfig.get_response(prompt, model == \"search\")\n        if response:\n            yield Reasoning(label=f\"Found {len(response.urls)} Video(s)\", status=\"\")\n            yield response\n            return\n        raise RuntimeError(\"Failed to find any videos for the prompt.\")\n","sourceCodeStart":146,"sourceCodeEnd":165,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/Video.py#L146-L165","documentation":"Raised as RuntimeError by the Video provider when RequestConfig.get_response(prompt, ...) returns a falsy value: the underlying video search found nothing (or failed silently) for the translated prompt. The prompt was valid but yielded no results.","triggerScenarios":"Searching for a video whose terms match nothing in the search backend, or the search request failing and returning None rather than raising.","commonSituations":"Overly specific/nonsense prompts, search backend temporarily down, prompts that translate (RequestConfig.translate_prompt) into terms with no matches.","solutions":["Retry with a simpler, more common-worded prompt","Catch RuntimeError and fall back to another video provider or skip the enhancement","Retry after a delay if the search backend may be temporarily unavailable"],"exampleFix":"# before\nresponse = client.chat.completions.create(model='search', messages=msgs, provider=g4f.Provider.Video)\n\n# after\ntry:\n    response = client.chat.completions.create(model='search', messages=msgs, provider=g4f.Provider.Video)\nexcept RuntimeError:\n    response = None  # degrade gracefully, skip video enrichment","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = ...create(..., provider=g4f.Provider.Video)\nexcept RuntimeError as e:\n    if 'Failed to find any videos' in str(e):\n        result = None  # video enrichment is optional; continue without it\n    else:\n        raise","preventionTips":["Treat video search as best-effort: wrap it and degrade gracefully","Prefer common, concrete terms in prompts to improve hit rate"],"tags":["no-results","video-search","runtime","g4f"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}