siyuan-note/siyuan · error
URL value is missing
Error message
URL value is missing
What it means
For KeyTypeURL values, normalizeNewItemTemplateValue requires a non-nil Value.URL object; otherwise it returns 'URL value is missing'. The normalizer clears every other field, so a URL-typed value without a URL payload is structurally invalid and rejected rather than silently kept.
Solutions
- Supply the URL object, e.g. {"url":{"content":"https://example.com"}}
- Rename the value's type to match what was actually provided (e.g. text)
- Remove the invalid value before pruning runs
- Guard callers with a nil check on Value.URL before invoking normalization
Example fix
// before
av.Value{Type: av.KeyTypeURL} // URL nil
// after
av.Value{Type: av.KeyTypeURL, URL: &av.ValueURL{Content: "https://example.com"}} Defensive patterns
Strategy: validation
Validate before calling
if v.Type == av.KeyTypeURL && v.URL == nil {
return fmt.Errorf("URL value requires a URL object")
} Type guard
func hasURL(v *av.Value) bool { return v != nil && v.Type == av.KeyTypeURL && v.URL != nil } Prevention
- Set Value.URL.Content, not Value.Text, for url-typed values
- Validate template payloads against the value schema before calling pruning APIs
- Keep URL assets in mAsset fields, URLs in url fields
When it happens
Trigger: PruneInvalidNewItemTemplateFieldValues / normalizeNewItemTemplateFieldValues called on a value whose key type is KeyTypeURL but whose Value.URL pointer is nil (URL object missing in the template JSON or zero-value struct).
Common situations: Templates authored by hand where only a text string was supplied instead of a URL object; plugins creating new rows programmatically and leaving Value.URL unset after setting Value.Type to url.
Related errors
- checkbox value is missing
- date value is missing
- email value is missing
- phone value is missing
- at least one visible view is required
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/50448bc4de35f6f1.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/av/new_item_template.go:388
if nil == value.Date {
return nil, errors.New("date value is missing")
}
value.Text, value.Number, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypeSelect, KeyTypeMSelect:
var selections []*ValueSelect
for _, selection := range value.MSelect {
if nil != selection && "" != strings.TrimSpace(selection.Content) {
selections = append(selections, selection)
}
}
if KeyTypeSelect == key.Type && 1 < len(selections) {
selections = selections[:1]
}
value.MSelect = selections
value.Text, value.Number, value.Date, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypeURL:
if nil == value.URL {
return nil, errors.New("URL value is missing")
}
value.Text, value.Number, value.Date, value.MSelect, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypeEmail:
if nil == value.Email {
return nil, errors.New("email value is missing")
}
value.Text, value.Number, value.Date, value.MSelect, value.URL, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypePhone:
if nil == value.Phone {
return nil, errors.New("phone value is missing")
}
value.Text, value.Number, value.Date, value.MSelect, value.URL, value.Email, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypeMAsset:
var assets []*ValueAsset
for _, asset := range value.MAsset {
if nil != asset && "" != strings.TrimSpace(asset.Content) {
if AssetTypeFile != asset.Type && AssetTypeImage != asset.Type {
return nil, fmt.Errorf("invalid asset type [%s]", asset.Type)View on GitHub (pinned to 9f775e8a12)