{"record":{"id":"b4e3e396281b95f1","repo":"JuliusBrussee/caveman","slug":"practice-findings-sync-failed-response-status","errorCode":null,"errorMessage":"practice findings sync failed (${response.status})","messagePattern":"practice findings sync failed \\((.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":10104,"sourceCode":"    }));\n\n  const project = cfg.projectId ? `?project_id=${encodeURIComponent(cfg.projectId)}` : \"\";\n  const response = await fetch(`${cfg.baseURL}/api/v1/practice-findings${project}`, {\n    method: \"POST\",\n    headers: {\n      authorization: `Bearer ${cfg.token}`,\n      \"content-type\": \"application/json\",\n      \"x-cave-csrf\": \"cli\",\n    },\n    body: JSON.stringify({ findings }),\n  });\n  const result = (await response.json().catch(() => ({}))) as {\n    status?: string;\n    row_count?: number;\n    error?: { message?: string };\n  };\n  if (!response.ok || result.status !== \"completed\" || result.row_count !== findings.length) {\n    throw new Error(result.error?.message ?? `practice findings sync failed (${response.status})`);\n  }\n  return { kind: \"synced\", findings: findings.length };\n}\n\n// sync is the first-class verb: clear error when logged out, honest no-op when\n// there is nothing to send, one plain line when spans were uploaded.\nasync function sync() {\n  const cfg = await config();\n  requireAuth(cfg);\n  // These are independent evidence lanes. One corrupt/busy local store or one\n  // rejected practice POST must not starve the pending first-run aggregate;\n  // all lanes run, successful ones settle, then explicit sync reports any\n  // partial failure non-zero so the operator can retry it.\n  const [savingsLane, practicesLane, localScanLane] = await Promise.allSettled([\n    syncLocalSavings(cfg),\n    syncLocalPracticeFindings(cfg),\n    syncPendingLocalScan(cfg),\n  ] as const);","sourceCodeStart":10086,"sourceCodeEnd":10122,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/5184b3d11ac6a1acb7d44b9bfaa31698157cff97/packages/cli/src/index.ts#L10086-L10122","documentation":"The practice-findings POST returned a response failing the completion invariants (non-OK status, status not completed, unexpected row_count, or server error); the sync aborts and will retry on the next pass.","triggerScenarios":"Thrown at packages/cli/src/index.ts:9259 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry `caveman sync`; the upload is idempotent (stable finding ids)","Inspect the server error message; verify the auth token and project_id"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5184b3d11ac6a1acb7d44b9bfaa31698157cff97","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}