{"record":{"id":"67b3d740707ddb9b","repo":"siyuan-note/siyuan","slug":"number-value-is-missing","errorCode":null,"errorMessage":"number value is missing","messagePattern":"number value is missing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/new_item_template.go","lineNumber":366,"sourceCode":"\tif 0 == len(fieldValues) {\n\t\titemTemplate.FieldValues = nil\n\t} else {\n\t\titemTemplate.FieldValues = fieldValues\n\t}\n\treturn nil\n}\n\nfunc normalizeNewItemTemplateValue(value *Value, key *Key) (*Value, error) {\n\tvalue = value.Clone()\n\tswitch key.Type {\n\tcase KeyTypeText:\n\t\tif nil == value.Text {\n\t\t\treturn nil, errors.New(\"text value is missing\")\n\t\t}\n\t\tvalue.Number, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil\n\tcase KeyTypeNumber:\n\t\tif nil == value.Number {\n\t\t\treturn nil, errors.New(\"number value is missing\")\n\t\t}\n\t\tvalue.Text, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil\n\tcase KeyTypeDate:\n\t\tif nil == value.Date {\n\t\t\treturn nil, errors.New(\"date value is missing\")\n\t\t}\n\t\tvalue.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\n\tcase KeyTypeSelect, KeyTypeMSelect:\n\t\tvar selections []*ValueSelect\n\t\tfor _, selection := range value.MSelect {\n\t\t\tif nil != selection && \"\" != strings.TrimSpace(selection.Content) {\n\t\t\t\tselections = append(selections, selection)\n\t\t\t}\n\t\t}\n\t\tif KeyTypeSelect == key.Type && 1 < len(selections) {\n\t\t\tselections = selections[:1]\n\t\t}\n\t\tvalue.MSelect = selections","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/av/new_item_template.go#L348-L384","documentation":"normalizeNewItemTemplateValue for KeyTypeNumber requires value.Number != nil — the Number sub-struct holds the numeric content and its format. A Static-mode value on a Number column that omits the Number pointer is rejected.","triggerScenarios":"Static mode on a Number column but Value.Number is nil; client sent &av.Value{} with no Number sub-pointer; type mismatch in an import.","commonSituations":"Partial Value from a client that populated a different sub-field; column-type change after template authoring.","solutions":["Set Value.Number = &av.ValueNumber{Content: <float64>, Format: ...} when key.Type is KeyTypeNumber.","Ensure the sub-pointer matches key.Type exactly.","Validate shape client-side before submit."],"exampleFix":"// before\n&av.Value{}  // key.Type == KeyTypeNumber\n// after\n&av.Value{Number: &av.ValueNumber{Content: 42}}","handlingStrategy":"type-guard","validationCode":"if key.Type == av.KeyTypeNumber && value.Number == nil {\n    value.Number = &av.ValueNumber{Content: 0}\n}","typeGuard":"func hasNumberValue(v *av.Value) bool { return v != nil && v.Number != nil }","tryCatchPattern":null,"preventionTips":["Set Value.Number for Number columns before submit.","Match the Value sub-pointer to key.Type exactly.","Add a client-side shape check before the save call."],"tags":["av","new-item-template","number","value","validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}