openzipkin/zipkin · error · Error
Failed to fetch trace from backend
Error message
Failed to fetch trace from backend
What it means
Thrown in zipkin-lens's TracePage HeaderMenu when the browser fetch of the raw trace JSON (GET /api/v2/trace/{traceId}) returns a non-OK HTTP status. The archive flow needs the raw JSON from the backend because it is not cached in the browser, so a failed fetch aborts archiving with this error.
Source
Thrown at zipkin-lens/src/components/TracePage/Header/HeaderMenu.tsx:63
: undefined;
const handleMenuButtonClick = (
event: React.MouseEvent<HTMLButtonElement>,
) => {
setAnchorEl(event.currentTarget);
};
const handleMenuClose = () => {
setAnchorEl(null);
};
const handleArchiveButtonClick = useCallback(() => {
// We don't store the raw json in the browser yet, so we need to make an
// HTTP call to retrieve it again.
fetch(`${api.TRACE}/${trace.traceId}`)
.then((response) => {
if (!response.ok) {
throw new Error('Failed to fetch trace from backend');
}
return response.json();
})
.then((json) => {
// Add zipkin.archived tag to root span
/* eslint-disable-next-line no-restricted-syntax */
for (const span of json) {
if ('parentId' in span === false) {
const tags = span.tags || {};
tags['zipkin.archived'] = 'true';
span.tags = tags;
break;
}
}
return json;
})
.then((json) => {
return fetch(archivePostUrl, {View on GitHub (pinned to 878ce2a1fa)
Solutions
- Verify the trace still exists: open it in the UI or curl GET /api/v2/trace/{traceId} and expect 200
- If it returns 404, the trace expired from storage — re-produce the trace or increase storage retention
- Check server/proxy logs and the browser network tab for 401/403/5xx and fix routing or auth for the /api path
- Retry after transient backend errors; fetch again before re-clicking Archive
Defensive patterns
Strategy: retry
Validate before calling
// check the trace still exists before offering/attempting archive
const res = await fetch(`${api.TRACE}/${trace.traceId}`);
if (!res.ok) {
// 404 => trace evicted from storage; 5xx => backend issue
throw new Error(`Trace not available (HTTP ${res.status})`);
} Try / catch
try {
const response = await fetch(`${api.TRACE}/${trace.traceId}`);
if (!response.ok) throw new Error(`Fetch trace failed (HTTP ${response.status})`);
const json = await response.json();
} catch (err) {
// 404 is permanent (retention); 5xx/network may be transient -> one retry max
if (isTransient(err)) await retryOnce();
else showUserError('Trace no longer available in the backend');
} Prevention
- Disable/hide the Archive button for traces older than the storage retention window
- Surface the HTTP status in the alert so users can distinguish 404 from backend failure
- Keep the Lens base URL and proxy config pointing at a reachable Zipkin server
When it happens
Trigger: Clicking 'Archive Trace' in the Lens UI when the trace has been dropped from storage (e.g. past the retention/lookback window) and the API returns 404; the Zipkin server or proxy in front of it returns 401/403/500; a misconfigured base URL so the request 404s; transient network failure making response.ok false.
Common situations: Trying to archive an old trace that storage (in-memory, MySQL, ES with TTL) already evicted; running Lens against a reverse proxy that blocks or rewrites /api routes; server restart with in-memory storage wiping all traces.
Related errors
- Failed to archive the trace
- Timeout establishing connection to RabbitMQ server: {e.getMe
- Cannot gunzip spans
- No content reading Elasticsearch/OpenSearch version
AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14).
Data as JSON: /api/errors/927924e231c358b5.
Report an issue: GitHub.