Skip to main content
Applies to:
  • Plan - Any
  • Deployment - Any
  • Use case - Inspect a deployed code scorer whose source preview is missing.
A deployed code scorer can run even when its source code isn’t visible. For an uploaded code bundle, Braintrust stores a reference to the executable bundle and an optional source preview. The preview is for display and isn’t required to execute the scorer. If a preview wasn’t captured during upload, the UI can display This function is too complex to edit in the UI instead of source code. That message alone doesn’t mean the scorer is broken.

Inspect the stored definition

Use the bt CLI to retrieve the function object:
The command retrieves the latest version by default. Add --version <version> if you’re investigating a specific deployed version. See bt functions view for all selectors. For a bundled code scorer, check these fields in the returned function object:

Find the original source

Check the repository or files used to publish the scorer. A bundle_id identifies the executable bundle, but it isn’t a source preview. Creating another scorer that references the same bundle does not restore a missing preview or reconstruct the original source files. If you still have the source, keep it in version control. Preview availability depends on the upload workflow, so republishing alone doesn’t guarantee a preview.

Add a preview from known source

If you have the source that matches the deployed bundle, you can add it as a display-only preview:
  1. Retrieve the latest function object with bt functions view --id <function-id> --json.
  2. Copy the complete function_data object and set function_data.data.preview to the source code as a JSON string. Preserve the other fields, including bundle_id, location, and runtime_context.
  3. Use Partially update function to send the updated object in the request body’s function_data field to PATCH /v1/function/{function_id}.
  4. Retrieve the latest definition again to confirm the preview was saved, then refresh the scorer page to view it.
This adds a preview without replacing the executable bundle. It doesn’t recover lost source code. If you need help investigating a missing preview, contact Braintrust support with:
  • The function ID and the version you inspected.
  • The original publish command and CLI or SDK version, if known.
  • The returned function_data object, with sensitive source or configuration values removed.
If execution also fails, include the exact invocation error. A missing preview alone doesn’t establish why execution failed.