{"record":{"id":"6c3aa002ecc3dc76","repo":"diegosouzapw/OmniRoute","slug":"data-error-failedfetch","errorCode":null,"errorMessage":"${data.error} || failedFetch","messagePattern":"(.+?) \\|\\| failedFetch","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/audit/ComplianceTab.tsx","lineNumber":99,"sourceCode":"  const [selectedEntry, setSelectedEntry] = useState<AuditEntry | null>(null);\n\n  const fetchEntries = useCallback(async () => {\n    setLoading(true);\n    setError(null);\n\n    try {\n      const params = new URLSearchParams();\n      if (actor) params.set(\"actor\", actor);\n      params.set(\"limit\", String(PAGE_SIZE));\n      params.set(\"offset\", String(offset));\n      if (eventType) params.set(\"action\", eventType);\n      if (from) params.set(\"from\", from);\n      if (to) params.set(\"to\", to);\n\n      const response = await fetch(`/api/compliance/audit-log?${params.toString()}`);\n      const data = await response.json().catch(() => []);\n      if (!response.ok) {\n        throw new Error(data.error || t(\"failedFetch\"));\n      }\n\n      setEntries(Array.isArray(data) ? data : []);\n      const total = Number(response.headers.get(\"x-total-count\") || \"0\");\n      setTotalCount(Number.isFinite(total) ? total : 0);\n    } catch (err) {\n      setError(err instanceof Error ? err.message : t(\"failedFetch\"));\n    } finally {\n      setLoading(false);\n    }\n  }, [actor, eventType, from, offset, t, to]);\n\n  useEffect(() => {\n    void fetchEntries();\n  }, [fetchEntries]);\n\n  const visibleEntries = useMemo(() => {\n    if (severity === \"all\") return entries;","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/(dashboard)/dashboard/audit/ComplianceTab.tsx#L81-L117","documentation":"ComplianceTab's audit-log loader got a non-OK from /api/compliance/audit-log with the filter params (actor/action/from/to/limit/offset). Prefers the server's data.error string; only when the body has none does it fall back to the localized 'failedFetch' key.","triggerScenarios":"Thrown at src/app/(dashboard)/dashboard/audit/ComplianceTab.tsx:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the actor/action/from/to query filters against the API contract","Return a structured error string from the audit-log route","Check server logs for the failing compliance query"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}