{"record":{"id":"4af12b7533a0b651","repo":"run-llama/llama_index","slug":"no-valid-source-provided-to-resolve-binary-data","errorCode":null,"errorMessage":"No valid source provided to resolve binary data!","messagePattern":"No valid source provided to resolve binary data!","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/utils.py","lineNumber":710,"sourceCode":"            else:\n                # Data is not base64 encoded in the URL (URL-encoded text)\n                if as_base64:\n                    # Encode the text data as base64\n                    return BytesIO(base64.b64encode(url_data.encode(\"utf-8\")))\n                else:\n                    # Return as text bytes\n                    return BytesIO(url_data.encode(\"utf-8\"))\n\n        headers = {\n            \"User-Agent\": \"LlamaIndex/0.0 (https://llamaindex.ai; info@llamaindex.ai) llama-index-core/0.0\"\n        }\n        response = requests.get(url, headers=headers, timeout=(60, 60))\n        response.raise_for_status()\n        if as_base64:\n            return BytesIO(base64.b64encode(response.content))\n        return BytesIO(response.content)\n\n    raise ValueError(\"No valid source provided to resolve binary data!\")\n","sourceCodeStart":692,"sourceCodeEnd":711,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/utils.py#L692-L711","documentation":"The terminal fallback of llama-index-core's binary resolution utility: it is reached only when neither a file `path` nor a `url` argument was supplied. The function walks through path-based, base64-based, and URL-based branches, and if all preconditions failed it raises this ValueError instead of returning empty or guessed data. It almost always indicates a caller bug or a variable that silently evaluated to None.","triggerScenarios":"Calling the resolver with both `path=None` and `url=None`; passing only a `data:` URL that failed an earlier branch's scheme check; passing keyword arguments with misspelled names (e.g. `image_url=` instead of `url=`) so the real parameters stay None.","commonSituations":"Optional config where the user left both source fields blank; conditionally-built arguments where an if/else chain forgets one branch; refactors that renamed the parameter; agent/LLM tool calls that omit required source fields.","solutions":["Pass exactly one valid source: either `path=\"/path/to/file\"` or `url=\"https://...\"` / `\"data:...\"`.","Check for misspelled or unexpected keyword names against the function signature.","Add an explicit caller-side check that at least one of path/url is non-None before invoking the resolver.","If the value should never be None, fail earlier in your pipeline with a clearer error about which field is missing."],"exampleFix":"# before\nbuf = resolve_binary_data(path=None, url=None)  # ValueError\n\n# after\nassert path or url, \"provide either path or url\"\nbuf = resolve_binary_data(url=url) if url else resolve_binary_data(path=path)","handlingStrategy":"validation","validationCode":"def validate_binary_source(path, url):\n    if not (path or url):\n        raise ValueError(\"resolve_binary_data requires exactly one of path or url\")\n    return True","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require exactly one non-None source field in your calling code before invoking the resolver.","Use keyword arguments matching the documented signature to avoid silent None defaults.","Fail early with your own descriptive error naming the missing field."],"tags":["validation","binary-data","caller-bug","python"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}