Budibase/budibase · error

Provided edit screen route is invalid

Error message

Provided edit screen route is invalid

What it means

getTableScreenTemplate builds the "new screen" table template, which needs an edit (detail) screen route containing a single `:id` parameter. It splits updateScreenRoute on ":id" and requires exactly two segments (prefix and suffix) so it can splice a row-id binding into the route. Any route that doesn't contain exactly one `:id` placeholder makes the generated gridblock's row-click navigation impossible, so it throws.

Source

Thrown at packages/builder/src/templates/screenTemplating/table/newScreen.ts:64

    .instanceName(`${tableOrView.name} - Create`)
    .customProps({
      hAlign: "right",
      buttons: [createButton.json()],
    })
    .gridDesktopColSpan(7, 13)
    .gridDesktopRowSpan(1, 3)

  const heading = new Component("@budibase/standard-components/textv2")
    .instanceName("Table heading")
    .customProps({
      text: `## ${tableOrView.name}`,
    })
    .gridDesktopColSpan(1, 7)
    .gridDesktopRowSpan(1, 3)

  const updateScreenRouteSegments = updateScreenRoute.split(":id")
  if (updateScreenRouteSegments.length !== 2) {
    throw new Error("Provided edit screen route is invalid")
  }

  const tableBlock = new Component("@budibase/standard-components/gridblock")
    .instanceName(`${tableOrView.name} - Table`)
    .customProps({
      table: tableOrView.datasourceSelectFormat,
      allowAddRows: false,
      allowEditRows: false,
      allowDeleteRows: false,
      onRowClick: [
        {
          id: 0,
          "##eventHandlerType": "Navigate To",
          parameters: {
            type: "url",
            url: `${updateScreenRouteSegments[0]}{{ ${safe(
              "eventContext"
            )}.${safe("row")}._id }}${updateScreenRouteSegments[1]}`,

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Make sure the edit-screen route contains exactly one `:id` segment, e.g. "/person/:id"
  2. Fix param syntax/casing: must be lowercase `:id`, not `:ID`, `{id}`, or `:id1`
  3. If a second param is needed, restructure the route so only one `:id` appears
  4. Verify the route value passed from the calling UI (NewScreen flow) is the detail screen route, not the list screen route

Example fix

// before
getTableScreenTemplate({ updateScreenRoute: "/person/edit", ... })
// after
getTableScreenTemplate({ updateScreenRoute: "/person/:id", ... })
Defensive patterns

Strategy: validation

Validate before calling

function validateEditRoute(route: string) {
  const segments = route.split(":id")
  if (segments.length !== 2) {
    throw new Error(`Edit route "${route}" must contain exactly one :id param`)
  }
}

Type guard

function hasSingleIdParam(route: string): boolean {
  return route.split(":id").length === 2
}

Try / catch

try {
  return await tableScreenTemplate({ route, updateScreenRoute, ... })
} catch (err) {
  if ((err as Error).message === "Provided edit screen route is invalid") {
    console.error(`Edit route "${updateScreenRoute}" lacks exactly one :id`)
  }
  throw err
}

Prevention

When it happens

Trigger: Calling getTableScreenTemplate (via tableScreenTemplate) with updateScreenRoute that has no `:id` (e.g. "/dataperson"), more than one `:id` (e.g. "/person/:id/:id"), or `:id` embedded in a way that yields != 2 segments after split.

Common situations: Programmatic screen generation passing a list-screen URL as the edit route; hand-constructed routes in scripts/plugins using `:id1`/`:Id` casing or `{id}` syntax instead of `:id`; routes copied from other frameworks using different param syntax.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/66737a036ddef32b. Report an issue: GitHub.