{"record":{"id":"737b9fae19f98f21","repo":"HKUDS/nanobot","slug":"unsupported-reference-image-p","errorCode":null,"errorMessage":"unsupported reference image: {p}","messagePattern":"unsupported reference image: (.+?)","errorType":"exception","errorClass":"ImageGenerationError","httpStatus":null,"severity":"error","filePath":"nanobot/providers/image_generation.py","lineNumber":103,"sourceCode":"def _as_json_object(value: object) -> dict[str, Any] | None:\n    \"\"\"Narrow an untrusted provider response value to a JSON object.\"\"\"\n    return cast(dict[str, Any], value) if isinstance(value, dict) else None\n\n\ndef _as_json_objects(value: object) -> list[dict[str, Any]]:\n    \"\"\"Return object entries from an untrusted provider response array.\"\"\"\n    if not isinstance(value, list):\n        return []\n    return [cast(dict[str, Any], item) for item in cast(list[object], value) if isinstance(item, dict)]\n\n\ndef _read_image_b64(path: str | Path) -> tuple[str, str]:\n    \"\"\"Return ``(mime, base64)`` for the image at ``path``.\"\"\"\n    p = Path(path).expanduser()\n    raw = p.read_bytes()\n    mime = detect_image_mime(raw)\n    if mime is None:\n        raise ImageGenerationError(f\"unsupported reference image: {p}\")\n    return mime, base64.b64encode(raw).decode(\"ascii\")\n\n\ndef image_path_to_data_url(path: str | Path) -> str:\n    \"\"\"Convert a local image path to an image data URL.\"\"\"\n    mime, encoded = _read_image_b64(path)\n    return f\"data:{mime};base64,{encoded}\"\n\n\ndef image_path_to_inline_data(path: str | Path) -> dict[str, str]:\n    \"\"\"Convert a local image path to a Gemini ``inlineData`` payload dict.\"\"\"\n    mime, encoded = _read_image_b64(path)\n    return {\"mimeType\": mime, \"data\": encoded}\n\n\ndef _b64_image_data_url(value: str) -> str:\n    encoded = \"\".join(value.split())\n    try:","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/providers/image_generation.py#L85-L121","documentation":"Error \"unsupported reference image: {p}\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/providers/image_generation.py:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}