{"record":{"id":"6f9a9dd9196e10e1","repo":"NousResearch/hermes-agent","slug":"not-a-supported-image-file-explicit-path","errorCode":null,"errorMessage":"Not a supported image file: {explicit_path}","messagePattern":"Not a supported image file: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"cli.py","lineNumber":3973,"sourceCode":"\n\ndef _collect_query_images(query: str | None, image_arg: str | None = None) -> tuple[str, list[Path]]:\n    \"\"\"Collect local image attachments for single-query CLI flows.\"\"\"\n    message = query or \"\"\n    images: list[Path] = []\n\n    if isinstance(message, str):\n        dropped = _detect_file_drop(message)\n        if dropped and dropped.get(\"is_image\"):\n            images.append(dropped[\"path\"])\n            message = dropped[\"remainder\"] or f\"[User attached image: {dropped['path'].name}]\"\n\n    if image_arg:\n        explicit_path = _resolve_attachment_path(image_arg)\n        if explicit_path is None:\n            raise ValueError(f\"Image file not found: {image_arg}\")\n        if explicit_path.suffix.lower() not in _IMAGE_EXTENSIONS:\n            raise ValueError(f\"Not a supported image file: {explicit_path}\")\n        images.append(explicit_path)\n\n    deduped: list[Path] = []\n    seen: set[str] = set()\n    for img in images:\n        key = str(img)\n        if key in seen:\n            continue\n        seen.add(key)\n        deduped.append(img)\n    return message, deduped\n\n\n# Strip OSC escape sequences (e.g. OSC-8 hyperlinks) that prompt_toolkit's\n# ANSI parser can't handle — it strips \\x1b but passes the payload through\n# as literal text, garbling the TUI output.\n_OSC_ESCAPE_RE = re.compile(r\"\\x1b\\][\\s\\S]*?(?:\\x07|\\x1b\\\\)\")\n","sourceCodeStart":3955,"sourceCodeEnd":3991,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/cli.py#L3955-L3991","documentation":"Raised when an explicitly attached image argument resolves to an existing file whose extension is not in cli.py's _IMAGE_EXTENSIONS whitelist (defined at cli.py:3353, e.g. .png/.jpg/.jpeg/.gif/.webp). The path itself was already validated by _resolve_attachment_path, so only the file type is rejected. It exists to stop non-image files from being pushed into the vision pipeline.","triggerScenarios":"Calling the CLI with an explicit image attachment argument (image_arg) that points to a real file with an unsupported suffix, e.g. `--image photo.pdf`, `--image clip.bmp`, or `--image frame.tiff`. Any extension outside _IMAGE_EXTENSIONS throws; a missing file throws the different 'Image file not found' error one branch earlier.","commonSituations":"Attaching a PDF/HEIC screenshot from a phone, a .bmp from Windows paint, a file with an uppercase-but-unusual extension like .AVIF, or a typo'd extension (.jpq). Also renaming a file without converting it.","solutions":["Convert the file to a supported format (PNG or JPEG) before attaching, e.g. `magick input.bmp output.png`","Check the whitelist in cli.py:3353 (_IMAGE_EXTENSIONS) to confirm your extension is genuinely unsupported","If the format is a real image type the CLI should support, add the extension to _IMAGE_EXTENSIONS and re-run"],"exampleFix":"# before\nhermes --image ~/Downloads/photo.heic \"what is this?\"\n# ValueError: Not a supported image file: /home/u/Downloads/photo.heic\n\n# after (convert first)\nmagick ~/Downloads/photo.heic ~/Downloads/photo.jpg\nhermes --image ~/Downloads/photo.jpg \"what is this?\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\nfrom cli import _IMAGE_EXTENSIONS\n\ndef is_supported_image(p: str) -> bool:\n    return Path(p).suffix.lower() in _IMAGE_EXTENSIONS","typeGuard":"from pathlib import Path\nfrom cli import _IMAGE_EXTENSIONS\n\ndef is_supported_image_path(p: Path) -> bool:\n    return p.is_file() and p.suffix.lower() in _IMAGE_EXTENSIONS","tryCatchPattern":"try:\n    msg, images = cli.prepare_message_with_images(text, image_arg=path)\nexcept ValueError as e:\n    if str(e).startswith(\"Not a supported image file\"):\n        show_error(f\"{path}: convert to PNG/JPEG first\")\n    else:\n        raise","preventionTips":["Convert attachments to PNG or JPEG before passing them to --image","Filter file-picker results against _IMAGE_EXTENSIONS before submit","Remember a missing file raises a different error — check existence separately"],"tags":["cli","image","vision","file-format"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}