{"record":{"id":"6b586caba5df619c","repo":"NousResearch/hermes-agent","slug":"image-file-not-found-image-arg","errorCode":null,"errorMessage":"Image file not found: {image_arg}","messagePattern":"Image file not found: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"cli.py","lineNumber":3971,"sourceCode":"\n    return min(max(visual_lines, 1), max(1, int(max_height or 1)))\n\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.","sourceCodeStart":3953,"sourceCodeEnd":3989,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/cli.py#L3953-L3989","documentation":"ValueError from the CLI image-attachment path in cli.py:3971: the explicitly passed --image argument could not be resolved to an existing file by _resolve_attachment_path, so the run is aborted before the message is sent. (A second, related check immediately after rejects files whose suffix is not in _IMAGE_EXTENSIONS.)","triggerScenarios":"Invoking the CLI with an image path that does not exist: typo, relative path resolved against an unexpected cwd, file on an unmounted share, or a path containing shell-unescaped spaces/globs. _resolve_attachment_path returning None is the trigger; only the resolved-not-None case proceeds to the extension check.","commonSituations":"Dragging a path from a file manager that includes quotes; running hermes from a different directory than where the image lives; the image was moved/deleted between compose and send; whitespace-only or empty argument after shell splitting.","solutions":["Check the file exists at exactly that path from the same cwd (or pass an absolute path).","Quote the argument if it contains spaces: hermes --image \"/path/with spaces/photo.png\".","Confirm the extension is a supported image type (_IMAGE_EXTENSIONS) once the path resolves — 'Not a supported image file' is the sibling error.","For programmatic callers, resolve and validate with Path(...).is_file() before invoking the CLI."],"exampleFix":"# before\n$ hermes 'describe this' --image screenshots/latest.png   # cwd-dependent, typo\nValueError: Image file not found: screenshots/latest.png\n\n# after\n$ hermes 'describe this' --image \"$HOME/Pictures/screenshots/latest.png\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\n_IMAGE_EXTENSIONS = {\".png\", \".jpg\", \".jpeg\", \".gif\", \".webp\", \".bmp\"}\n\ndef image_arg_ok(arg: str) -> bool:\n    p = Path(arg).expanduser()\n    return p.is_file() and p.suffix.lower() in _IMAGE_EXTENSIONS","typeGuard":null,"tryCatchPattern":"try:\n    run_with_image(prompt, image_arg=path)\nexcept ValueError as exc:\n    if \"not found\" in str(exc) or \"Not a supported\" in str(exc):\n        print(f\"check the image path: {exc}\")\n    raise","preventionTips":["Pass absolute paths, especially when the CLI runs from a different cwd.","Quote paths containing spaces; avoid unescaped globs.","Programmatic callers: Path(...).is_file() plus an extension check before invoking the CLI."],"tags":["cli","path","image","attachment"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}