siyuan-note/siyuan · error

attribute [ ] is only supported on tab containers

Error message

attribute [%s] is only supported on tab containers

What it means

ValidateTabsAttrs checks custom attributes written to nodes. The attributes tabs-active-id and tabs-position are only meaningful on a tab container (ast.NodeTabs). This error is returned when such an attribute is submitted for a node that is nil or not a tabs container.

Solutions

  1. Target the actual Tabs container block ID, not a child or unrelated block
  2. Remove the tabs-* custom attributes from non-tabs blocks
  3. Verify node type before setting attributes (check the block's type via the API)
  4. If a plugin sets these attrs, fix it to validate the node type first

Example fix

// before
setNodeAttrs(blockID, {"custom-tabs-position": "left"}) // blockID is a paragraph
// after
if block.type === "tabs" { setNodeAttrs(blockID, {"custom-tabs-position": "left"}) }
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetchSyncPost('/api/attr/getBlockAttrs', {id});
if (res.data.Type !== 'tabs') throw new Error('tabs attrs need a tabs container');

Type guard

function isTabsContainer(block) {
  return block && block.type === "tabs";
}

Try / catch

try {
  await setNodeAttrs(id, {"custom-tabs-position": "left"});
} catch (e) {
  if (e.message.includes("only supported on tab containers")) {
    console.warn("target block is not a tabs container", id);
  }
}

Prevention

When it happens

Trigger: Calling the attribute-setting API (setNodeAttrs0 path) with attributes like custom-tabs-position or custom-tabs-active-id on a block that is not a Tabs node; passing a nil node.

Common situations: Plugin/script applying tab attributes to a regular block; automation targeting the wrong node ID; UI bug sending tab attrs after the container was converted to another block type.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/f1f4d70156db871c. Report an issue: GitHub.

Appendix: source

Thrown at kernel/treenode/tabs.go:49

		if nil == ret {
			ret = item
		}
		if item.ID == activeID {
			return item
		}
	}
	return
}

// ValidateTabsAttrs 在修改属性前校验页签属性,避免部分属性已写入后才发现错误。
func ValidateTabsAttrs(node *ast.Node, attrs map[string]string) error {
	for name, value := range attrs {
		name = strings.ToLower(name)
		if TabsActiveIDAttr != name && TabsPositionAttr != name {
			continue
		}
		if nil == node || ast.NodeTabs != node.Type {
			return fmt.Errorf("attribute [%s] is only supported on tab containers", name)
		}
		value = strings.TrimSpace(util.RemoveInvalidRetainCtrl(value))
		if "" == value {
			continue
		}
		if TabsPositionAttr == name {
			if "top" != value && "left" != value {
				return fmt.Errorf("invalid tabs position [%s]", value)
			}
			continue
		}
		found := false
		for item := node.FirstChild; nil != item; item = item.Next {
			if ast.NodeTabItem == item.Type && item.ID == value {
				found = true
				break
			}
		}

View on GitHub (pinned to 9f775e8a12)