supabase/supabase · error · Error

Failed to fetch full values for truncated cells

Error message

Failed to fetch full values for truncated cells

What it means

Thrown in onCopyRows when hydrateTruncatedRows (a server query that fetches full values for cells whose displayed value was truncated) returns a non-'ok' status. This only fires for tables that have truncated string values AND a primary key (tables without a PK are blocked earlier with a dedicated toast). The error indicates the on-demand fetch of full cell values failed.

Source

Thrown at apps/studio/components/grid/components/header/Header.tsx:249

            A selected row has a column value that needs to be fetched on demand due to its size,
            but the table has no primary key.
          </p>
        </div>,
        { duration: 8000 }
      )
    }

    setIsCopying(true)
    const formatted = (async () => {
      const hydrated = await hydrateTruncatedRows({
        rows: selected,
        table: snap.table,
        projectRef: project.ref,
        connectionString: project.connectionString ?? null,
        roleImpersonationState: roleImpersonationState as RoleImpersonationState,
      })
      if (hydrated.status !== 'ok') {
        throw new Error('Failed to fetch full values for truncated cells')
      }
      const rows = hydrated.rows
      if (type === 'csv') {
        return formatRowsForCSV({
          rows,
          columns: snap.table!.columns.map((column) => column.name),
        })
      } else if (type === 'sql') {
        return formatTableRowsToSQL(snap.table, rows)
      } else {
        return JSON.stringify(rows)
      }
    })()

    copyToClipboard(formatted, () => toast.success('Copied rows to clipboard')).finally(() => {
      setIsCopying(false)
    })
  }

View on GitHub (pinned to beee91b9c2)

Solutions

  1. Retry the copy — transient DB/network errors often resolve on the second attempt.
  2. If using role impersonation, switch to a role with SELECT on the truncated columns and retry.
  3. Verify the project is not paused and the database is reachable.
  4. As a workaround, run a direct SELECT in the SQL editor for the specific primary keys to fetch full values manually.

Example fix

// before
const hydrated = await hydrateTruncatedRows({ rows: selected, table: snap.table, projectRef, connectionString, roleImpersonationState })
if (hydrated.status !== 'ok') {
  throw new Error('Failed to fetch full values for truncated cells')
}

// after — surface the underlying failure reason
if (hydrated.status !== 'ok') {
  toast.error(`Failed to fetch full values for truncated cells: ${hydrated.error?.message ?? 'unknown error'}`)
  return
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check: only attempt hydration when there are truncated cells and a usable PK
const canHydrate = snap.table.primaryKey && snap.table.primaryKey.length > 0 && selected.some((r) => Object.values(r).some((v) => typeof v === 'string' && isValueTruncated(v)))
if (!canHydrate) { /* skip hydration / warn user */ }

Type guard

function isHydrateOk(r: unknown): r is { status: 'ok'; rows: any[] } {
  return typeof r === 'object' && r !== null && (r as any).status === 'ok'
}

Try / catch

copyToClipboard((async () => {
  const hydrated = await hydrateTruncatedRows({ ... })
  if (hydrated.status !== 'ok') {
    toast.error(`Failed to fetch full values: ${(hydrated as any).error?.message ?? 'unknown'}`)
    return null
  }
  return formatRowsForCSV({ rows: hydrated.rows, columns: snap.table!.columns.map((c) => c.name) })
})(), () => toast.success('Copied'))

Prevention

When it happens

Trigger: User selects rows containing truncated (oversized) cell values and copies them as CSV/JSON/SQL; the hydrate query to fetch full values by primary key fails (DB error, timeout, connection issue, or role-impersonation conflict).

Common situations: Large text/jsonb columns whose display is truncated; network blip or DB load during the hydration query; role impersonation or RLS blocking the select; connectionString stale; project paused.

Related errors


AI-assisted analysis of supabase/supabase@beee91b9c2 (2026-08-12). Data as JSON: /api/errors/94d5b92f5eccdbfe. Report an issue: GitHub.