siyuan-note/siyuan · error

ErrSpecTooNew

ErrSpecTooNew

Error message

attribute view spec is too new

What it means

ErrSpecTooNew signals that an attribute view (.av JSON) was written by a newer SiYuan version whose storage Spec is higher than this kernel can parse. The kernel refuses to load or upgrade the database block to avoid silently dropping or corrupting fields it does not understand. It is a sentinel error returned by CheckSpec and surfaced during tree parsing / fix operations.

Source

Thrown at kernel/av/av.go:1347

		}
	}
	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")
	ErrRichTextSpecMismatch   = errors.New("attribute view rich text requires storage spec 9")
	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,逗号分隔
	NodeAttrContextFilter  = "custom-sy-av-context-filter" // 用于保存数据库块独有的上下文筛选配置
	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 8641553a1f)

Solutions

  1. Upgrade SiYuan (kernel + frontend) to a version whose av Spec supports the data; the Spec check only fails when the data is newer.
  2. If a downgrade is intentional, do not open the affected database blocks with the old version; re-sync or revert those .av files to a Spec the old version supports (from a backup made with that version).
  3. In API callers, surface Conf.Language(215) (i18n 'database is too new' style message) to the user as done at kernel/api/av.go:1418 instead of a raw error.
  4. Never hand-edit the .av JSON `spec` field downwards; rich-text and other features gate on specific specs and data would be rejected or lost.

Example fix

// before (old kernel opening new data)
err := av.CheckSpec(attrView) // -> av.ErrSpecTooNew

// after
// upgrade the SiYuan installation so the kernel's max supported spec
// is >= the spec stored in the .av file, then retry:
if err := av.CheckSpec(attrView); errors.Is(err, av.ErrSpecTooNew) {
	return fmt.Errorf("database requires a newer SiYuan version; please upgrade")
}
Defensive patterns

Strategy: validation

Validate before calling

func avSpecSupported(spec int, maxSupported int) bool { return spec <= maxSupported }

Try / catch

if err := av.CheckSpec(v); errors.Is(err, av.ErrSpecTooNew) {
	// surface upgrade prompt: model.Conf.Language(215)
}

Prevention

When it happens

Trigger: Loading or saving an attribute view whose JSON `spec` field is greater than the highest spec supported by the running kernel; av.CheckSpec / parseJSON2Tree / fixTreeJSONData on a .av file produced by a newer version; API handlers (kernel/api/av.go:1418, kernel/api/block.go:1235) that render documents containing such a database block.

Common situations: Opening a workspace synced from a newer SiYuan client (e.g. after a downgrade, or mobile/older desktop client sharing the same sync target); restoring an old backup binary against data written by a new version; running an outdated kernel build with up-to-date user data.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/8ca05dca1fe0bdc6. Report an issue: GitHub.