> ## Documentation Index
> Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs page broken by custom column expression

> Resolve "Field 'spans' not found in schema" errors caused by a saved custom column expression in the Logs table.

export const plans_0 = "Any"

export const deployments_0 = "Any"

export const data_plane_version_0 = undefined

export const use_case_0 = "Use case: Resolve Field spans not found in schema errors caused by saved custom column expressions in the Logs table by identifying and editing or deleting the offending columns. Includes API and HAR identification, quoting guidance, and CLI and Loop workarounds."

<Note>
  **Applies to:**

  * Plan - {plans_0}
  * Deployment - {deployments_0}
  * {data_plane_version_0}
  * {use_case_0}
</Note>

## Summary

Logs page shows "Field 'spans' not found in schema" or parser errors.
Cause: a saved custom column expression references span-level fields or uses invalid bracket indexing.
Fix: edit or remove the offending custom column or use the CLI workaround.

## What is happening

The Logs table sends every saved custom column expression with the rows query.
If one column references a field that is not present in the query shape (for example `spans` in the `summary` shape) or uses invalid indexing, the whole rows query fails and the UI shows the error.
CSV export fails for the same reason. The CLI does not send saved columns, so it can succeed.

## Fix or suggestion

### Option 1: edit or delete the offending custom column (recommended)

1. Go to the project [**<Icon icon="activity" /> Logs**](https://www.braintrust.dev/app/~/logs).
2. Click <Icon icon="settings-2" /> **Display** on the right.
3. Find the custom columns that reference `spans` or use bracket indexing with non-numeric keys.
4. Edit the expression to use dot-quoted keys, or delete the column.
5. Save the **Display** settings and reload the Logs page.

### Option 2: identify the column via API and fix remotely

1. Get the project ID:

   ```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
   curl -s "$BRAINTRUST_API_URL/v1/project?project_name=<PROJECT_NAME>" \
     -H "Authorization: Bearer $BRAINTRUST_API_KEY"
   ```

2. List the project's Logs table custom columns:

   ```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
   curl -s "$BRAINTRUST_API_URL/v1/column?object_type=project&object_id=<PROJECT_ID>&subtype=project_log" \
     -H "Authorization: Bearer $BRAINTRUST_API_KEY"
   ```

3. Inspect the returned column `expr` values for references to `spans` or bracketed non-numeric keys. Edit or delete the offending column via the UI or API.

<Note>
  To narrow down the cause, toggle your Logs view from **Traces** to **Spans**. The error message shown there will identify the specific broken expression.
</Note>

Optional: capture a HAR from browser devtools (Network, Preserve log, reload, Save all as HAR with content) to see the full failing query and expressions.

<Warning>
  HARs contain auth tokens. Do not share them publicly or with anyone outside your support channel.
</Warning>

### Temporary workaround

Use the CLI to list spans explicitly. The CLI does not send saved columns.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
bt logs --project <project_id> --list-mode spans
```

Or run queries with the `spans` shape in SQL:

```sql theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
SELECT * FROM project_logs('<project_id>', shape => 'spans') LIMIT 10;
```

## How to confirm it worked

* The Logs page loads rows without the "Field 'spans' not found in schema" error.
* CSV export downloads successfully and displays rows.

## Notes

* Bracket indexing only accepts numeric indices. Use dot-quoted keys for object properties with special characters: `parent."key with spaces".child."Label"`.
* The CLI workaround works because it does not attach saved custom columns to the rows query.
