{"record":{"id":"00a0dd744b880939","repo":"iflytek/astron-agent","slug":"response-data-message-response-data-desc","errorCode":null,"errorMessage":"response.data.message || response.data.desc","messagePattern":"response\\.data\\.message \\|\\| response\\.data\\.desc","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"console/frontend/src/services/trace.ts","lineNumber":51,"sourceCode":"  rawStatus?: Record<string, unknown>;\n  usage?: WorkflowTraceUsage;\n  input?: Record<string, unknown>;\n  config?: Record<string, unknown>;\n  output?: Record<string, unknown>;\n  logs?: string[];\n};\n\nexport type WorkflowTraceExecutionDetail = {\n  execution: WorkflowTraceExecutionItem;\n  nodes: WorkflowTraceNode[];\n};\n\n// TODO: trans fn use\nexport async function getTraceList(params: any) {\n  try {\n    const response: any = await http.get(`/trace/getTrace`, { params });\n    if (response?.data.code !== 0) {\n      throw new Error(response.data.message || response.data.desc);\n    }\n    return response.data.data;\n  } catch (error: any) {\n    message.error(error?.message ?? '获取trace日志失败');\n    throw error;\n  }\n}\n\nexport const getTraceCount = async (params: {\n  botId: string;\n  startTime: string;\n  endTime: string;\n}) => {\n  try {\n    const response: any = await http.get(`/trace/count`, { params });\n\n    if (response?.data.code !== 0) {\n      throw new Error(response.data.message || response.data.desc);","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/frontend/src/services/trace.ts#L33-L69","documentation":"getTraceList calls GET /trace/getTrace and throws Error(response.data.message || response.data.desc) when the business code is not 0; the catch block additionally shows an antd message toast and rethrows. The thrown text is the backend's error message/description for a failed trace-list query.","triggerScenarios":"The trace service returns code !== 0 — trace backend unreachable/down, invalid query params (bad time range, oversized limit), tenant/space headers missing or unauthorized, or the trace storage (e.g. Elasticsearch) query failing server-side.","commonSituations":"Observability stack not deployed in self-hosted environments so /trace/getTrace 500s; date-range parameters formatted incorrectly; user lacks space permissions for the queried traces; tracing feature flag disabled server-side.","solutions":["Check the trace service health and its backing storage (ES/Jaeger) in the target deployment; the frontend toast shows the backend's raw reason.","Validate params before calling: startTime < endTime, valid ISO strings, sane pagination limits.","Verify space-id/enterprise-id headers are attached (axios interceptor) for the current tenant.","Handle the rethrown error upstream so the list shows an empty/error state instead of an unhandled rejection, and avoid double-toasting since getTraceList already calls message.error."],"exampleFix":"// before\nconst traces = await getTraceList(params);\nsetTraces(traces);\n// after\ntry {\n  const traces = await getTraceList(params);\n  setTraces(traces ?? []);\n} catch {\n  setTraces([]); // message already shown by getTraceList\n  setErrorState(true);\n}","handlingStrategy":"try-catch","validationCode":"// validate params before requesting\nif (!params.startTime || !params.endTime || params.startTime >= params.endTime) {\n  message.warning('请选择有效的时间范围');\n  return;\n}","typeGuard":"function hasTraceParams(p: any): p is { startTime: string; endTime: string } {\n  return !!p && typeof p.startTime === 'string' && typeof p.endTime === 'string' && p.startTime < p.endTime;\n}","tryCatchPattern":"try {\n  const list = await getTraceList(params);\n  setTraces(list ?? []);\n} catch {\n  setTraces([]); // toast already shown inside getTraceList\n  setErrorState(true);\n}","preventionTips":["Ensure the trace service and its storage are deployed and healthy","Validate time-range and pagination params client-side","Confirm space-id/enterprise-id headers are attached by the axios interceptor","Don't double-toast: getTraceList already shows message.error before rethrowing"],"tags":["tracing","api","observability","antd"],"backgroundTag":"api-error-response","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}