{"record":{"id":"f981afc7c9d1aa81","repo":"diegosouzapw/OmniRoute","slug":"geterrormessage-payload-tcommon-error","errorCode":null,"errorMessage":"getErrorMessage(payload, tCommon(\"error\"))","messagePattern":"getErrorMessage\\(payload, tCommon\\(\"error\"\\)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/settings/components/PayloadRulesTab.tsx","lineNumber":143,"sourceCode":"    if (parsedEditor.error || !parsedEditor.value) {\n      setMessage({\n        type: \"error\",\n        text: parsedEditor.error || t(\"payloadValidJsonRequired\"),\n      });\n      return;\n    }\n\n    setSaving(true);\n    setMessage(null);\n    try {\n      const response = await fetch(\"/api/settings/payload-rules\", {\n        method: \"PUT\",\n        headers: { \"Content-Type\": \"application/json\" },\n        body: JSON.stringify(parsedEditor.value),\n      });\n      const payload = await response.json();\n      if (!response.ok) {\n        throw new Error(getErrorMessage(payload, tCommon(\"error\")));\n      }\n\n      setEditorValue(JSON.stringify(payload, null, 2));\n      setMessage({ type: \"success\", text: t(\"payloadSaveSuccess\") });\n    } catch (error) {\n      setMessage({\n        type: \"error\",\n        text: error instanceof Error ? error.message : tCommon(\"error\"),\n      });\n    } finally {\n      setSaving(false);\n    }\n  };\n\n  return (\n    <Card>\n      <div className=\"flex flex-col gap-5\">\n        <div className=\"flex items-start gap-3\">","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/(dashboard)/dashboard/settings/components/PayloadRulesTab.tsx#L125-L161","documentation":"Save failure for the payload rules tab: after local JSON validation passes (parsedEditor), the PUT to /api/settings/payload-rules returned non-ok, and getErrorMessage(payload, tCommon('error')) extracts the sanitized server reason or falls back to a generic localized error. The rules config on disk is unchanged; only the local editor copy differs.","triggerScenarios":"Thrown at src/app/(dashboard)/dashboard/settings/components/PayloadRulesTab.tsx:143 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the PUT response body — server-side schema validation of the rules sections is the usual rejection","Fix the offending default/override/filter section and re-apply","Confirm no concurrent settings revision conflict, then retry"],"exampleFix":null,"handlingStrategy":"try-catch","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"}