{"record":{"id":"15b140248cc5867d","repo":"alibaba/arthas","slug":"error-15b140","errorCode":null,"errorMessage":"火焰图获取失败","messagePattern":"火焰图获取失败","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"labs/arthas-jfr-frontend/src/services/jfr.ts","lineNumber":34,"sourceCode":"  if (json.code !== 1) throw new Error(json.msg || '元数据获取失败');\n  return json;\n}\n\n// 获取火焰图数据\nexport async function fetchJfrFlameGraph({ fileId, dimension, include, taskSet }) {\n  const body = {\n    namespace: 'jfr-file',\n    api: 'flameGraph',\n    target: fileId,\n    parameters: { dimension, include, taskSet }\n  };\n  const res = await fetch('/arthas-api/analysis', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify(body)\n  });\n  const json = await res.json();\n  if (json.code !== 1) throw new Error(json.msg || '火焰图获取失败');\n  return json;\n} ","sourceCodeStart":16,"sourceCodeEnd":36,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/labs/arthas-jfr-frontend/src/services/jfr.ts#L16-L36","documentation":"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.","triggerScenarios":"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.","commonSituations":"Selecting a dimension/filter combination that yields no data; very large JFR causing a backend timeout; concurrent analysis overload.","solutions":["Log and surface json.msg (it overrides this fallback) to see the backend reason.","Loosen/verify the dimension, include, and taskSet parameters and retry.","Ensure the referenced fileId is still valid and the analysis service has enough memory/time."],"exampleFix":"// before\nconst fg = await fetchJfrFlameGraph({ fileId, dimension, include, taskSet });\n\n// after\ntry {\n  const fg = await fetchJfrFlameGraph({ fileId, dimension, include, taskSet });\n} catch (e) {\n  showError('火焰图获取失败: ' + e.message);\n  // retry with default filters\n}","handlingStrategy":"try-catch","validationCode":"async function safeFetchFlameGraph(p) {\n  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 } }) });\n  if (!res.ok) throw new Error('HTTP ' + res.status);\n  const json = await res.json();\n  if (json.code !== 1) throw new Error(json.msg || 'flame graph failed');\n  return json;\n}","typeGuard":null,"tryCatchPattern":"try { const fg = await fetchJfrFlameGraph(params); }\ncatch (e) { showError('火焰图获取失败: ' + e.message); retryWithDefaults(params); }","preventionTips":["Validate dimension/include/taskSet before calling.","Show json.msg to the user.","Handle large-file timeouts with a retry."],"tags":["network","jfr","flame-graph","fetch","backend"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}