siyuan-note/siyuan · error

field [ ] not found in view [ ]

Error message

field [%s] not found in view [%s]

What it means

After switching on the view layout, setAttrViewColFullRow searches the view's fields for operation.ID; if the field is not present in that view (for table/kanban/gallery layouts) it reports that the field was not found. The operation also returns av.ErrWrongLayoutType for layouts that do not support full-row fields.

Solutions

  1. Verify operation.ID matches an existing key/column ID of the exact view (re-fetch the attribute view and check view fields) before sending.
  2. Use the field's ID, not its name or UI label.
  3. If the field was deleted, skip or recreate the field instead of retrying the toggle.
  4. Ensure operation.AvID and the view selection match the view containing the field.

Example fix

// before
setColFullRow(avID, viewId, fieldName); // name, not ID
// after
const field = view.fields.find(f => f.name === fieldName);
if (field) setColFullRow(avID, viewId, field.id);
Defensive patterns

Strategy: validation

Validate before calling

const view = attrView.views.find(v => v.id === viewID);
if (!view || !view.fields.some(f => f.id === fieldID)) throw new Error('field not found in view: ' + fieldID);

Type guard

const fieldExists = (view: { fields: { id: string }[] } | undefined, id: string): boolean => !!view && view.fields.some(f => f.id === id);

Try / catch

try { await setColFullRow(avID, viewID, fieldID, fullRow); } catch (e) { if (String(e).includes('not found in view')) { await refreshAttrView(avID); } else throw e; }

Prevention

When it happens

Trigger: Sending setAttrViewColFullRow with operation.ID set to a field (Key/Column) ID that does not exist in the target view — wrong view ID in the operation, deleted field, or an ID from another database.

Common situations: Stale field ID cached after the column was removed; passing the field name instead of its ID; targeting the wrong avID/view so the lookup runs against an unrelated view; concurrent edits between listing fields and toggling.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/attribute_view.go:1949

			if field.ID == operation.ID {
				field.FullRow = fullRow
				found = true
				break
			}
		}
	case av.LayoutTypeKanban:
		for _, field := range view.Kanban.Fields {
			if field.ID == operation.ID {
				field.FullRow = fullRow
				found = true
				break
			}
		}
	default:
		return av.ErrWrongLayoutType
	}
	if !found {
		return fmt.Errorf("field [%s] not found in view [%s]", operation.ID, view.ID)
	}

	err = av.SaveAttributeView(attrView)
	return
}

func getAttrViewOperationView(attrView *av.AttributeView, operation *Operation) (ret *av.View, err error) {
	if "" != operation.ViewID {
		ret = attrView.GetView(operation.ViewID)
		if nil == ret {
			err = av.ErrViewNotFound
		}
		return
	}
	return getAttrViewViewByBlockID(attrView, operation.BlockID)
}

func getAttrViewOperationNumber(operation *Operation) (ret float64, err error) {

View on GitHub (pinned to 9f775e8a12)