siyuan-note/siyuan · error

item not found

Error message

item not found

What it means

Sentinel ErrItemNotFound. Returned when a row/item id is not found among the AV's values (model/attribute_view.go:7687 and tested at attribute_view_value_identity_test.go:125). The targeted database row was deleted or does not exist in this AV.

Source

Thrown at kernel/av/av.go:1298

		if err := os.MkdirAll(av, 0755); err != nil {
			logging.LogErrorf("create attribute view dir failed: %s", err)
			return
		}
	}
	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 251596fc0d)

Solutions

  1. Reload the AV rows and operate only on current item ids.
  2. Make update operations idempotent: if the item is gone, treat the update as a no-op rather than an error.
  3. Serialize row deletes and updates per AV to avoid the race.

Example fix

// before
op := &av.Operation{Action: "update", id: rowID, data: v}
err := model.UpdateAttributeView(op)   // row deleted elsewhere -> item not found

// after: tolerate a vanished row
if errors.Is(err, av.ErrItemNotFound) {
    // refresh and skip, or re-create the row as needed
    return nil
}
Defensive patterns

Strategy: try-catch

Try / catch

err := model.UpdateAttributeView(op)
if errors.Is(err, av.ErrItemNotFound) {
    // row vanished concurrently; treat as no-op
    return nil
}

Prevention

When it happens

Trigger: Calling an operation that updates, deletes, or moves a specific row by itemID when that row id is no longer present — e.g. updating a value for a row deleted in another session, or operating on a row id from a different AV.

Common situations: Stale client state after row deletion elsewhere; plugin reusing a row id after the row was removed; race between a delete-row and an in-flight update-row on the same item.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/35c28e8ad440ea96. Report an issue: GitHub.