siyuan-note/siyuan · error · ErrSpecTooNew

attribute view spec is too new

Error message

attribute view spec is too new

What it means

ErrSpecTooNew is returned by av.CheckSpec (kernel/av/av_fix.go:44-49) when an attribute-view JSON carries av.Spec greater than CurrentSpec (currently 7). Each spec bump is a one-way data migration; a newer kernel wrote the file, so this older kernel cannot safely interpret it.

Solutions

  1. Upgrade SiYuan to at least the version that wrote the file (the spec number increases monotonically with migrations upgradeSpec1..upgradeSpec7 in kernel/av/av_fix.go)
  2. If upgrading is impossible, restore the .av.json from history (kernel/history.db snapshots) or from a data-repo snapshot taken before the upgrade
  3. Avoid mixed-version sync: upgrade all clients of the same workspace before editing databases
Defensive patterns

Strategy: fallback

Validate before calling

attrView, err := av.ParseAttributeView(avID)
if err == nil {
    if err := av.CheckSpec(attrView); errors.Is(err, av.ErrSpecTooNew) {
        // refuse to edit; prompt upgrade, offer history restore
    }
}

Type guard

func isSpecTooNew(err error) bool {
    return errors.Is(err, av.ErrSpecTooNew)
}

Prevention

When it happens

Trigger: Opening a database created or migrated by a newer SiYuan after downgrading the app; opening a synced workspace whose .av.json was upgraded by a newer client on another device; ParseAttributeView / render paths calling CheckSpec (kernel/api/av.go:1365 maps it to the localized message 215: 'Cannot open database view created by a newer version. Please upgrade to the latest version and try again').

Common situations: User downgrades to an older AppImage/installer; mixed versions across devices on the same sync repo; testing an export bundle produced by a beta build on a stable build.

Related errors


AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18). Data as JSON: /api/errors/9a75b54dac4983a4. Report an issue: GitHub.

Appendix: source

Thrown at kernel/av/av.go:1301

		}
	}
	return
}

func GetAttributeViewI18n(key string) string {
	return util.AttrViewLangs[util.Lang][key].(string)
}

var (
	ErrAttributeViewNotFound  = errors.New("attribute view not found")
	ErrInvalidAttributeViewID = errors.New("invalid attribute view id")
	ErrInvalidBoxID           = errors.New("invalid box id")
	ErrViewNotFound           = errors.New("view not found")
	ErrKeyNotFound            = errors.New("key not found")
	ErrItemNotFound           = errors.New("item not found")
	ErrWrongLayoutType        = errors.New("wrong layout type")
	ErrInvalidColumnAlign     = errors.New("invalid column align")
	ErrSpecTooNew             = errors.New("attribute view spec is too new")
	ErrFilterTooDeep          = errors.New("filter nesting depth exceeds the maximum allowed")
)

const (
	NodeAttrNameAvs        = "custom-avs"                 // 用于标记块所属的属性视图,逗号分隔 av id
	NodeAttrView           = "custom-sy-av-view"          // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443
	NodeAttrVisibleViewIDs = "custom-sy-av-visible-views" // 用于标记数据库块显示的视图 ID,逗号分隔
	NodeAttrViewStaticText = "custom-sy-av-s-text"        // 用于标记块所属的属性视图静态文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049

	NodeAttrViewNames = "av-names" // 用于临时标记块所属的属性视图名称,空格分隔
)

View on GitHub (pinned to afa823b6b4)