Budibase/budibase · error

View name is required

Error message

View name is required

What it means

ViewsStore.delete deletes a view by its name via API.deleteView(view.name). Since the view name is the view's identifier, deleting a view without a name is invalid, so the store throws before making the request.

Source

Thrown at packages/builder/src/stores/builder/views.ts:58

      {
        selectedViewName: null,
      },
      makeDerivedStore
    )

    this.select = this.select.bind(this)
  }

  select = (name: string) => {
    this.store.update(state => ({
      ...state,
      selectedViewName: name,
    }))
  }

  delete = async (view: View) => {
    if (!view.name) {
      throw new Error("View name is required")
    }
    await API.deleteView(view.name)

    // Update tables
    tables.update(state => {
      const table = state.list.find(table => table._id === view.tableId)
      if (table?.views && view.name) {
        delete table.views[view.name]
      }
      return { ...state }
    })
  }

  save = async (view: View & { originalName?: string }) => {
    if (!view.name) {
      throw new Error("View name is required")
    }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Ensure the view object passed comes from the views store or a full API fetch including name
  2. Check you are not passing a table object where a view is expected
  3. If the view name is dynamic, validate it is a non-empty string before calling delete
  4. Guard the call: if (!view?.name) return before invoking delete

Example fix

// before
await views.delete(partialView)
// after
if (!partialView?.name) return
await views.delete(partialView)
Defensive patterns

Strategy: validation

Validate before calling

if (typeof view?.name !== "string" || !view.name.trim()) {
  throw new Error("Cannot delete a view without a name")
}

Type guard

const isNamedView = (v: View): v is View & { name: string } =>
  typeof v.name === "string" && v.name.trim().length > 0

Try / catch

try {
  await views.delete(view)
} catch (e) {
  if (e.message === "View name is required") {
    console.warn("View object missing name — skipping delete")
  } else throw e
}

Prevention

When it happens

Trigger: Calling views.delete(view) with a View object lacking a name property — e.g. a partial view object, a table-level placeholder, or a view constructed locally in code.

Common situations: Passing the wrong object type (a table instead of a view); deserialized view data missing name; iterating over a mixed list of tables and views; typo'd field (viewName vs name).

Related errors


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