hcengineering/platform · error

failed to find editor popup for ${typeClass._id}

Error message

failed to find editor popup for ${typeClass._id}

What it means

ShowEditor resolves the attribute's editor configuration from the view.mixin.AttributeEditor mixin on the attribute's type class and throws when the popup property is undefined. The action only supports opening editors defined as popups; a type without a registered popup editor cannot be edited inline. It is a model/configuration gap rather than a runtime failure.

Source

Thrown at plugins/view-resources/src/actionImpl.ts:526

    props?: Record<string, any>
  }
): Promise<void> {
  const docs = Array.isArray(doc) ? doc : doc !== undefined ? [doc] : []
  evt.preventDefault()
  let cprops = {
    ...(props?.props ?? {})
  }
  if (docs.length === 1) {
    const client = getClient()
    const hierarchy = client.getHierarchy()
    const doc: Doc = docs[0]
    const attribute = hierarchy.getAttribute(doc._class, props.attribute)

    const typeClass = hierarchy.getClass(attribute.type._class)
    const attributeEditorMixin = hierarchy.as(typeClass, view.mixin.AttributeEditor)

    if (attributeEditorMixin?.popup === undefined) {
      throw new Error(`failed to find editor popup for ${typeClass._id}`)
    }

    const editor: AnySvelteComponent = await getResource(attributeEditorMixin.popup)

    cprops = {
      ...cprops,
      ...{
        value: (doc as any)[props.attribute]
      }
    }

    if (editor !== undefined) {
      const identifier = await getObjectId(doc, hierarchy)
      showPopup(
        editor,
        cprops,
        {
          getBoundingClientRect: () => new DOMRect((evt as MouseEvent).clientX, (evt as MouseEvent).clientY)

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Register an AttributeEditor popup for the type class in the view model (view.mixin.AttributeEditor with popup pointing to a Svelte component).
  2. Use an editor action appropriate for the attribute type instead of ShowEditor.
  3. Check that the plugin providing the editor is installed and its resources are loaded.
  4. Verify attribute props.attribute matches a type that supports popup editing.

Example fix

// before
setAttributeEditor(typeClass) // no popup registered
// after
await client.createDoc(view.mixin.AttributeEditor, core.space.Model, {
  attachedTo: typeClass._id,
  popup: myPlugin.component.EditorPopup
} as AttributeEditor)
Defensive patterns

Strategy: validation

Validate before calling

const attr = hierarchy.getAttribute(doc._class, props.attribute)
const mixin = attr && hierarchy.as(hierarchy.getClass(attr.type._class), view.mixin.AttributeEditor)
if (mixin?.popup === undefined) console.warn(`No popup editor for ${props.attribute}; skipping inline edit`)

Type guard

function hasPopupEditor(h: Hierarchy, cls: Ref<Class<Doc>>, attr: string): boolean {
  const a = h.getAttribute(cls, attr)
  return a !== undefined && h.as(h.getClass(a.type._class), view.mixin.AttributeEditor)?.popup !== undefined
}

Try / catch

try { await showEditor(doc, props) } catch (e) { if (e.message.includes('editor popup')) openDefaultForm(doc); else throw e }

Prevention

When it happens

Trigger: Invoking the ShowEditor action (e.g. click-to-edit on a table cell) for an attribute whose type class has no AttributeEditor mixin popup registered in the view model.

Common situations: Adding a custom attribute/type without registering an editor popup; typo in the editor resource ref; third-party plugin types lacking editor definitions; using ShowEditor on non-editable presentation attributes.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/4310d6a028baf84e. Report an issue: GitHub.