NousResearch/hermes-agent · error

image upload did not return a path

Error message

image upload did not return a path

What it means

The upload endpoint answered 2xx but the JSON body lacked a `path` field, so the client cannot hand a file path to the TUI's /image command. This is a contract violation between the dashboard client and the gateway's /api/chat/image-upload handler, not a transport failure.

Source

Thrown at web/src/lib/chatImagePaste.ts:161

  const dataUrl = await fileToDataUrl(file);
  const qs = profile ? `?profile=${encodeURIComponent(profile)}` : "";
  const res = await authedFetch(`/api/chat/image-upload${qs}`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      data_url: dataUrl,
      filename,
    }),
  });

  if (!res.ok) {
    const text = await res.text().catch(() => res.statusText);
    throw new Error(text || `HTTP ${res.status}`);
  }

  const uploaded = (await res.json()) as ChatImageUploadResult;
  if (!uploaded?.path) {
    throw new Error("image upload did not return a path");
  }
  return uploaded;
}

View on GitHub (pinned to c896c09c42)

Solutions

  1. Confirm the gateway version matches the web build — rebuild/redeploy so client and server agree on the `{path}` contract.
  2. Inspect the actual response body in the network tab to see what shape the server returned; fix the handler or the client to match.
  3. Remove any proxy/interceptor that rewrites /api/chat/image-upload responses.
Defensive patterns

Strategy: type-guard

Type guard

function isUploadResult(v: unknown): v is ChatImageUploadResult {
  return !!v && typeof v === 'object' && typeof (v as ChatImageUploadResult).path === 'string' && (v as ChatImageUploadResult).path.length > 0
}

Try / catch

const raw: unknown = await res.json()
if (!isUploadResult(raw)) {
  throw new Error(`unexpected upload response shape: ${JSON.stringify(raw).slice(0, 200)}`)
}

Prevention

When it happens

Trigger: A 200 response from a proxy/health endpoint returning unrelated JSON, a gateway version whose handler returns a differently-named field (e.g. `file_path`), or a handler bug returning `{ok: true}` without the stored path.

Common situations: Version skew between built web assets and the running gateway (older/newer handler shape), a reverse proxy intercepting the route, or custom middleware rewriting response bodies.

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/2a59706d5d3c967b. Report an issue: GitHub.