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
- Confirm the gateway version matches the web build — rebuild/redeploy so client and server agree on the `{path}` contract.
- Inspect the actual response body in the network tab to see what shape the server returned; fix the handler or the client to match.
- 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
- Pin gateway and web-bundle versions together so the {path} contract holds.
- Add an integration test asserting the endpoint returns {path} on success.
- Don't put proxies or body-rewriting middleware in front of /api/chat/image-upload.
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
- clipboard image is empty
- image too large (max ${mb} MB)
- text || HTTP ${res.status}
- Missing URL
- Invalid data URL
AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14).
Data as JSON: /api/errors/2a59706d5d3c967b.
Report an issue: GitHub.