siyuan-note/siyuan · error
URL value is missing
Error message
URL value is missing
What it means
normalizeNewItemTemplateValue for KeyTypeURL requires value.URL != nil — the URL sub-struct holds the link content and optional description. A Static-mode value on a URL column that omits the URL pointer is rejected.
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 251596fc0d)
Solutions
- Set Value.URL = &av.ValueURL{Content: "https://example.com"} when key.Type is KeyTypeURL.
- Ensure the sub-pointer matches key.Type exactly.
- Validate shape client-side before submit.
Example fix
// before
&av.Value{} // key.Type == KeyTypeURL
// after
&av.Value{URL: &av.ValueURL{Content: "https://example.com"}} Defensive patterns
Strategy: type-guard
Validate before calling
if key.Type == av.KeyTypeURL && value.URL == nil {
value.URL = &av.ValueURL{Content: ""}
} Type guard
func hasURLValue(v *av.Value) bool { return v != nil && v.URL != nil } Prevention
- Set Value.URL for URL columns before submit.
- Match the Value sub-pointer to key.Type exactly.
- Add a client-side shape check before the save call.
When it happens
Trigger: Static mode on a URL column but Value.URL is nil; client sent &av.Value{} with no URL sub-pointer; type mismatch in an import.
Common situations: Partial Value from a client that populated a different sub-field; column-type change after template authoring.
Related errors
- new item template field [%s] value is invalid: %w
- text value is missing
- number value is missing
- date value is missing
- new item templates config is nil
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/50448bc4de35f6f1.
Report an issue: GitHub.