JuliusBrussee/caveman · error · Error

practice findings sync failed (${response.status})

Error message

practice findings sync failed (${response.status})

What it means

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.

Source

Thrown at packages/cli/src/index.ts:10104

    }));

  const project = cfg.projectId ? `?project_id=${encodeURIComponent(cfg.projectId)}` : "";
  const response = await fetch(`${cfg.baseURL}/api/v1/practice-findings${project}`, {
    method: "POST",
    headers: {
      authorization: `Bearer ${cfg.token}`,
      "content-type": "application/json",
      "x-cave-csrf": "cli",
    },
    body: JSON.stringify({ findings }),
  });
  const result = (await response.json().catch(() => ({}))) as {
    status?: string;
    row_count?: number;
    error?: { message?: string };
  };
  if (!response.ok || result.status !== "completed" || result.row_count !== findings.length) {
    throw new Error(result.error?.message ?? `practice findings sync failed (${response.status})`);
  }
  return { kind: "synced", findings: findings.length };
}

// sync is the first-class verb: clear error when logged out, honest no-op when
// there is nothing to send, one plain line when spans were uploaded.
async function sync() {
  const cfg = await config();
  requireAuth(cfg);
  // These are independent evidence lanes. One corrupt/busy local store or one
  // rejected practice POST must not starve the pending first-run aggregate;
  // all lanes run, successful ones settle, then explicit sync reports any
  // partial failure non-zero so the operator can retry it.
  const [savingsLane, practicesLane, localScanLane] = await Promise.allSettled([
    syncLocalSavings(cfg),
    syncLocalPracticeFindings(cfg),
    syncPendingLocalScan(cfg),
  ] as const);

View on GitHub (pinned to 5184b3d11a)

Solutions

  1. Retry `caveman sync`; the upload is idempotent (stable finding ids)
  2. Inspect the server error message; verify the auth token and project_id
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/cli/src/index.ts:9259 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@5184b3d11a (2026-08-18). Data as JSON: /api/errors/b4e3e396281b95f1. Report an issue: GitHub.