POST /api/fg/contracts returns 500 for fastbooks' contract; error truncated by a >256KB log #640

Open
opened 2026-10-06 07:56:55 +00:00 by gmackie · 0 comments
Owner

POST /api/fg/contracts returns 500 with an empty body for fastbooks' contract, so its CI publish step (gmackie/fastbooks#1, advisory) silently fails and the app shows no contract.

Reproduce

fastbooks at 4420ab4e (main): pnpm -F @fastbooks/contract-spec generate then FG_SERVER=https://forgegraf.com FG_API_TOKEN=… pnpm exec fg contract publish --file sdks/contract/contract.json --commit <sha> → status 500. Same with an admin token and with CI's deploy token.

What is ruled out

  • The contract is valid: validateContract passes (IR v1, 172 operations, 0 public, auth modes mixed/anonymous/user, no SLA/SLO, 496 KB).
  • projectContract (packages/api/src/lib/contract-ingest.ts, current main) projects it without error, run locally.
  • No \u0000 or lone surrogates (jsonb-invalid) in the JSON.
  • Not size per se: forgegraph's own 331-operation, 364 KB contract published fine at 07:30 UTC today; the slo column (0109) is present.

Evidence

Live tail during the request: POST https://forgegraf.com/api/fg/contracts 500, followed by "Log size limit exceeded: More than 256KB … during a single request", so the real exception (probably a database error that echoes the bound parameters, i.e. the whole IR) is truncated and never visible.

Suggestions

  1. Catch and log the error without the query parameters (error code/message only), and return it as JSON so CLI users see the cause.
  2. Then the actual failure in the snapshot/operations transaction can be fixed.

Found while piloting contract publishing for the Forge console playground integrations. Filed by Claude Code on behalf of @gmackie.

`POST /api/fg/contracts` returns **500 with an empty body** for fastbooks' contract, so its CI publish step (gmackie/fastbooks#1, advisory) silently fails and the app shows no contract. ## Reproduce fastbooks at `4420ab4e` (main): `pnpm -F @fastbooks/contract-spec generate` then `FG_SERVER=https://forgegraf.com FG_API_TOKEN=… pnpm exec fg contract publish --file sdks/contract/contract.json --commit <sha>` → `status 500`. Same with an admin token and with CI's deploy token. ## What is ruled out - The contract is valid: `validateContract` passes (IR v1, 172 operations, 0 public, auth modes mixed/anonymous/user, no SLA/SLO, 496 KB). - `projectContract` (packages/api/src/lib/contract-ingest.ts, current main) projects it without error, run locally. - No `\u0000` or lone surrogates (jsonb-invalid) in the JSON. - Not size per se: forgegraph's own 331-operation, 364 KB contract published fine at 07:30 UTC today; the `slo` column (0109) is present. ## Evidence Live tail during the request: `POST https://forgegraf.com/api/fg/contracts 500`, followed by **"Log size limit exceeded: More than 256KB … during a single request"**, so the real exception (probably a database error that echoes the bound parameters, i.e. the whole IR) is truncated and never visible. ## Suggestions 1. Catch and log the error **without** the query parameters (error code/message only), and return it as JSON so CLI users see the cause. 2. Then the actual failure in the snapshot/operations transaction can be fixed. Found while piloting contract publishing for the Forge console playground integrations. Filed by Claude Code on behalf of @gmackie.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gmackie/ForgeGraph#640
No description provided.