JuliusBrussee/caveman · error · Error

local scan sync failed (${response.status})

Error message

local scan sync failed (${response.status})

What it means

The local scan sync POST returned a response that failed one of the completion invariants (non-OK status, or status/source/basis/id fields not matching a completed local_scan result); the sync pass aborts without advancing the watermark.

Source

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

    body: JSON.stringify(state.payload),
  });
  const result = (await response.json().catch(() => ({}))) as {
    id?: string;
    project_id?: string;
    status?: string;
    source?: string;
    basis?: string;
    error?: { message?: string };
  };
  if (
    !response.ok
    || result.status !== "completed"
    || result.source !== "local_scan"
    || result.basis !== "inferred"
    || typeof result.id !== "string"
    || !result.id
  ) {
    throw new Error(result.error?.message ?? `local scan sync failed (${response.status})`);
  }
  const delivered: LocalScanState = {
    ...state,
    delivered: {
      import_id: result.id,
      project_id: typeof result.project_id === "string" ? result.project_id : cfg.projectId ?? "",
      organization_id: cfg.organizationId ?? "",
      base_url: cfg.baseURL,
      delivered_at: new Date().toISOString(),
    },
  };
  mkdirSync(dirname(localScanStatePath()), { recursive: true });
  writeFileSync(localScanStatePath(), JSON.stringify(delivered, null, 2) + "\n", { mode: 0o600 });
  return { kind: "synced", importId: result.id, dashboard: deriveLocalScanDashboardUrl(cfg.baseURL) };
}

function localScanSyncLine(out: Extract<LocalScanSyncOutcome, { kind: "synced" }>): string {
  const destination = out.dashboard ? ` → ${out.dashboard}` : "";

View on GitHub (pinned to 5184b3d11a)

Solutions

  1. Retry `caveman sync` — the watermark is unchanged so the pass is idempotent
  2. Check the server error message when present; verify auth token validity
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/cli/src/index.ts:9017 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/db381a3c5dbe6510. Report an issue: GitHub.