alibaba/arthas · error · Error

火焰图获取失败

Error message

火焰图获取失败

What it means

Thrown by fetchJfrFlameGraph in jfr.ts when POSTing {namespace:'jfr-file', api:'flameGraph', parameters:{dimension, include, taskSet}} to /arthas-api/analysis and the response JSON has code !== 1. '火焰图获取失败' (flame graph fetch failed) is the fallback when the server provided no msg; the genuine cause is in json.msg or the backend log.

Source

Thrown at labs/arthas-jfr-frontend/src/services/jfr.ts:34

  if (json.code !== 1) throw new Error(json.msg || '元数据获取失败');
  return json;
}

// 获取火焰图数据
export async function fetchJfrFlameGraph({ fileId, dimension, include, taskSet }) {
  const body = {
    namespace: 'jfr-file',
    api: 'flameGraph',
    target: fileId,
    parameters: { dimension, include, taskSet }
  };
  const res = await fetch('/arthas-api/analysis', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(body)
  });
  const json = await res.json();
  if (json.code !== 1) throw new Error(json.msg || '火焰图获取失败');
  return json;
} 

View on GitHub (pinned to 21cf2e9ba5)

Solutions

  1. Log and surface json.msg (it overrides this fallback) to see the backend reason.
  2. Loosen/verify the dimension, include, and taskSet parameters and retry.
  3. Ensure the referenced fileId is still valid and the analysis service has enough memory/time.

Example fix

// before
const fg = await fetchJfrFlameGraph({ fileId, dimension, include, taskSet });

// after
try {
  const fg = await fetchJfrFlameGraph({ fileId, dimension, include, taskSet });
} catch (e) {
  showError('火焰图获取失败: ' + e.message);
  // retry with default filters
}
Defensive patterns

Strategy: try-catch

Validate before calling

async function safeFetchFlameGraph(p) {
  const res = await fetch('/arthas-api/analysis', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({ namespace:'jfr-file', api:'flameGraph', target:p.fileId, parameters:{ dimension:p.dimension, include:p.include, taskSet:p.taskSet } }) });
  if (!res.ok) throw new Error('HTTP ' + res.status);
  const json = await res.json();
  if (json.code !== 1) throw new Error(json.msg || 'flame graph failed');
  return json;
}

Try / catch

try { const fg = await fetchJfrFlameGraph(params); }
catch (e) { showError('火焰图获取失败: ' + e.message); retryWithDefaults(params); }

Prevention

When it happens

Trigger: Invalid/empty dimension, include, or taskSet parameters; backend flame-graph generation failed (e.g., no samples matched the filters); file expired or is still being analyzed.

Common situations: Selecting a dimension/filter combination that yields no data; very large JFR causing a backend timeout; concurrent analysis overload.

Related errors


AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14). Data as JSON: /api/errors/15b140248cc5867d. Report an issue: GitHub.