siyuan-note/siyuan · error

field name must not be empty

Error message

field name must not be empty

What it means

When updating the "name" setting of a database field, the new name must contain at least one non-whitespace character. A blank or whitespace-only name is rejected because a field must always have a usable display name.

Solutions

  1. Provide a non-empty name, e.g. {"name": "Due Date"}
  2. Trim-check the value client-side: if name.trim() === '' skip or prompt instead of sending
  3. If the intent was to remove the field, use the delete-column operation instead of renaming to empty

Example fix

// before
{"name": "   "}
// after
{"name": "Due Date"}
Defensive patterns

Strategy: validation

Validate before calling

function assertNonEmptyName(name) { if (typeof name !== 'string' || name.trim() === '') throw new Error('field name must not be empty'); }

Try / catch

try { await updateKeyConfig(avID, keyID, { name }); } catch (e) { if (/name must not be empty/.test(e.message)) { showNamePrompt(); } else throw e; }

Prevention

When it happens

Trigger: Calling UpdateAttributeViewKeyConfig with {"name": ""} or {"name": " "} via the databaseKeyUpdate path.

Common situations: UI forms submitted without filling the name; a 'clear the title' script using an empty string; trimming logic stripping the intended name away before send.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/attribute_view_key_config.go:52

		return err
	}
	key, err := attrView.GetKey(keyID)
	if nil != err {
		return err
	}
	op := &Operation{AvID: avID, ID: keyID, Typ: string(key.Type), Name: key.Name}
	for setting, value := range config {
		switch setting {
		case "name", "type", "icon", "desc", "numberFormat", "dateFormat", "template", "renderTemplate":
			text, ok := value.(string)
			if !ok {
				return fmt.Errorf("%s must be a string", setting)
			}
			op.Data, op.Format = text, text
			switch setting {
			case "name":
				if "" == strings.TrimSpace(text) {
					return errors.New("field name must not be empty")
				}
				op.Name = text
				return updateAttributeViewColumn(op)
			case "type":
				if _, err = newAttributeViewKey(keyID, key.Name, text, key.Icon, key.DateFormat); nil != err {
					return err
				}
				op.Typ = text
				return updateAttributeViewColumn(op)
			case "icon":
				return setAttributeViewColIcon(op)
			case "desc":
				return setAttributeViewColDesc(op)
			case "numberFormat":
				if av.KeyTypeNumber != key.Type || !slices.Contains(AttributeViewKeyNumberFormats, text) {
					return errors.New("numberFormat requires a number field and a supported format")
				}
				return updateAttributeViewColNumberFormat(op)

View on GitHub (pinned to 9f775e8a12)