siyuan-note/siyuan · error

invalid column align

Error message

invalid column align

What it means

Sentinel ErrInvalidColumnAlign. Returned by the column-align operation handler (model/attribute_view.go:6393) when operation.Data cannot be asserted to a string, or the resulting av.TableColumnAlign value fails IsValid(). Only applies to table-layout views (guarded earlier by av.LayoutTypeTable check).

Source

Thrown at kernel/av/av.go:1300

			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. Send the align value in the exact form the server's TableColumnAlign expects (check the IsValid enum set).
  2. Ensure operation.Data is a JSON string, not a number or object.
  3. Update the client to a version whose align constants match the server.

Example fix

// before
op := &av.Operation{Action: "setcolalign", ID: colID, Data: 2}   // number -> invalid

// after: send the canonical align string
op := &av.Operation{Action: "setcolalign", ID: colID, Data: "center"}
Defensive patterns

Strategy: validation

Validate before calling

// Ensure align is a valid enum string before submitting
align, ok := operation.Data.(string)
if !ok { return errors.New("align must be a string") }
a := av.TableColumnAlign(align)
if !a.IsValid() { return fmt.Errorf("invalid align value %q", align) }

Type guard

// TypeScript guard — match the server's TableColumnAlign set
const VALID_ALIGN = new Set(["left", "center", "right"])
function isValidAlign(v: unknown): v is string {
  return typeof v === "string" && VALID_ALIGN.has(v)
}

Prevention

When it happens

Trigger: Sending a setcolalign operation whose Data is not a string, or is a string that is not one of the recognized align enum names/values. Also if the client sends a numeric align code that does not map to a valid TableColumnAlign.

Common situations: Client bug sending align as a number instead of the enum string; a newer/older client using an align value the server does not recognize; malformed operation payload from a plugin.

Related errors


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